Count Pairs with Sum <= X

Hard
4 views 25 Jan 2026
Given a sorted array and X, count pairs (i...

Queue Rotation

Hard
6 views 25 Jan 2026
Commands: PUSH x, POP, ROTATE k (move first to end k times). Print final queue (space-separated)....

Max Overlapping Intervals

Hard
8 views 25 Jan 2026
Given n intervals [l,r], find the maximum number of overlaps at any point....

Grade from Marks

Easy
6 views 25 Jan 2026
Given marks (0..100), print grade: A(90+), B(80-89), C(70-79), D(60-69), else F....

Leap Year

Easy
5 views 25 Jan 2026
Print YES if the year is a leap year, otherwise NO....

Absolute Difference

Easy
7 views 25 Jan 2026
Given a and b, print |a-b|....

Factorial (Loop)

Easy
5 views 25 Jan 2026
Given n, print n! using a loop....

Count Positive Numbers

Easy
4 views 25 Jan 2026
You get n and then n integers. Count how many are > 0....

FizzBuzz

Medium
6 views 25 Jan 2026
Print numbers 1..n, but print Fizz for multiples of 3, Buzz for multiples of 5, and FizzBuzz for both....

Sum Until Zero

Medium
5 views 25 Jan 2026
Read integers until you see 0. Print the sum of numbers before 0....

Prime Check

Medium
5 views 25 Jan 2026
Given n, print PRIME if n is prime else NOT_PRIME....

Count Digits

Medium
5 views 25 Jan 2026
Print how many digits are in n (for n=0, answer is 1)....

Collatz Steps

Medium
6 views 25 Jan 2026
Starting from n, apply: if even n=n/2 else n=3n+1. Count steps to reach 1....

First Value Greater Than X

Medium
5 views 25 Jan 2026
Given n numbers and x, print the first number that is > x. If none, print -1....

Minimum in Matrix

Medium
7 views 25 Jan 2026
Given r and c and the matrix values, print the minimum value....

Balanced Brackets

Hard
5 views 25 Jan 2026
Input is a string with (), [], {}. Print YES if it is balanced, else NO....

Traffic Light Simulation

Hard
6 views 25 Jan 2026
Colors cycle: Red -> Green -> Yellow -> Red. Given start color and t steps, print final color....

Command Calculator

Hard
5 views 25 Jan 2026
Start value=0. Commands: ADD x, SUB x, MUL x, DIV x (integer, ignore if x=0). Print final value....

Longest Increasing Run

Hard
8 views 25 Jan 2026
Given n integers, find the length of the longest strictly increasing contiguous run....

One Step of Life

Hard
4 views 25 Jan 2026
Given r c and a grid of 0/1, apply one step of Conway's Game of Life and print new grid....