Sum numbers divisible by 3

Easy
6 views 23 Jan 2026
Task: return sum of numbers from 1..n that are divisible by 3. Use loop and if condition....

Count digits in a number

Easy
4 views 23 Jan 2026
Task: return how many digits are in an integer. Handle 0 properly....

Reverse digits

Easy
4 views 23 Jan 2026
Task: reverse digits of a number and return result (ignore overflow for now)....

Check leap year

Easy
5 views 23 Jan 2026
Task: return true if year is leap year using correct rules (divisible by 400, or divisible by 4 but not 100)....

Print star pattern count

Easy
6 views 23 Jan 2026
Task: return total stars printed in a triangle of height n (1+2+...+n)....

FizzBuzz count

Medium
5 views 23 Jan 2026
Task: count how many numbers in 1..n would print FizzBuzz (div by 3 and 5)....

Nth Fibonacci (iterative)

Medium
4 views 23 Jan 2026
Task: return nth Fibonacci number (0-indexed) using iterative loop....

GCD using Euclid

Medium
5 views 23 Jan 2026
Task: return gcd(a,b) using while loop (Euclid algorithm)....

Find first prime >= n

Medium
3 views 23 Jan 2026
Task: return the first prime number that is >= n....

Simulate simple ATM steps

Medium
5 views 23 Jan 2026
Task: given balance and withdrawals array, process in order. If withdrawal > balance skip it. Return final balance....

Minimum steps to reach target (1 or 2)

Hard
4 views 23 Jan 2026
Task: you can add 1 or 2 each move. Return minimum moves to reach exactly n....

Count paths in grid with obstacles

Hard
5 views 23 Jan 2026
Task: grid has 0 (free) and 1 (blocked). Return number of paths from (0,0) to (m-1,n-1) moving right/down....

Validate parentheses string

Hard
5 views 23 Jan 2026
Task: given a char array containing '(', ')', return true if it is balanced....

Binary search first >= target

Hard
4 views 23 Jan 2026
Task: return the first index where a[i] >= target in a sorted array, else return n....

Max subarray sum (Kadane)

Hard
4 views 23 Jan 2026
Task: return maximum subarray sum (at least one element)....