Odd Even and Big

Easy
2 views 24 Jan 2026
Read an integer n, output two words. First word should be EVEN or ODD. Second word should be BIG if n is greater than 100, otherwise SMALL....

Pass or Fail

Easy
2 views 24 Jan 2026
Marks m are provided (0 to 100). Output PASS if m is at least 35, otherwise output FAIL....

Absolute Without abs

Easy
4 views 24 Jan 2026
Read one integer n. Output its absolute value without using abs()....

Print 1 to N

Easy
3 views 24 Jan 2026
Read integer n, output numbers from 1 to n in one line separated by spaces. If n is 0, output nothing....

Sum Until Zero

Easy
3 views 24 Jan 2026
A list of integers is provided. Add numbers one by one until you see 0. Do not include 0 in sum. Output the sum....

Count Multiples of 7

Easy
3 views 24 Jan 2026
Read n integers. Count how many are divisible by 7 and output the count....

Leap Year Check

Easy
4 views 24 Jan 2026
Read a year y, output YES if it is a leap year else NO. Leap year rule: divisible by 400 or divisible by 4 but not by 100....

Max of Three Numbers

Easy
4 views 24 Jan 2026
Read three integers a, b, c. Output the maximum using if-else logic....

Vowel Consonant Other

Easy
2 views 24 Jan 2026
One character ch is provided. Output VOWEL if it is a vowel (a,e,i,o,u in any case), CONSONANT if it is an English letter but not vowel, else output OTHER....

Discount Slab

Easy
3 views 24 Jan 2026
Bill amount amt is provided. If amt is less than 1000, no discount. If amt is 1000 or more, give 10 percent discount. Output final payable as integer (rounded down)....

FizzBuzz Range

Medium
3 views 24 Jan 2026
Read integer n, for i from 1 to n output on new line: Fizz if i divisible by 3, Buzz if divisible by 5, FizzBuzz if divisible by both, else output i....

Break on Negative

Medium
2 views 24 Jan 2026
Read n integers. Read in order. Stop the moment you see a negative number. Output two values: how many numbers were processed before stopping, and their sum....

Collatz Steps

Medium
2 views 24 Jan 2026
Read integer n (>0). Do: if n is even n=n/2 else n=3n+1. Count steps until n becomes 1. Output steps....

Prime or Not

Medium
2 views 24 Jan 2026
Read integer n, output PRIME if it is prime else NOT. Use loop up to sqrt and break early....

GCD Using While

Medium
3 views 24 Jan 2026
Read two integers a and b. Compute gcd(a,b) using Euclid while loop and output it....

Digits in Base B

Medium
3 views 24 Jan 2026
Read n and base b (2 to 10). Count digits needed to write n in base b. For n=0 answer is 1....

First Peak Index

Medium
2 views 24 Jan 2026
Read n integers. A peak means a[i] is greater than both neighbours (i-1 and i+1). Output the first peak index (0-based). If no peak, output -1....

Command Calculator

Medium
2 views 24 Jan 2026
You will receive q queries of form: op a b, where op is ADD, SUB, MUL, DIV. For DIV, if b is 0 output ERR else output integer division a//b. Output answer for each query on new line....

Skip Multiples

Medium
3 views 24 Jan 2026
Read n and k, output numbers from 1 to n but skip numbers divisible by k. Output in one line separated by spaces....

Sum of Odd Positions

Medium
3 views 24 Jan 2026
Read n integers, sum the values at odd positions (1st, 3rd, 5th...) and output the sum....

Shipping Charge

Medium
2 views 24 Jan 2026
Read weight w (kg) and distance d (km). Charge rules: if w100 add extra 100. Output final charge....

Count Digits Letters Others

Medium
2 views 24 Jan 2026
A string s is provided (may contain spaces). Count how many characters are digits, how many are English letters, and how many are others. Output three counts....

Ways to Reach N

Medium
4 views 24 Jan 2026
You are at step 0 and want to reach step n. Each move you can go +1 or +2. Output number of ways modulo 1000000007....

Stop Word Printer

Medium
2 views 24 Jan 2026
Words are provided one by one. Output all words until you see the word stop (case sensitive). Do not output stop itself....

Trailing Zeros in Factorial

Medium
4 views 24 Jan 2026
Read n, find how many trailing zeros are in n factorial. Use loop dividing by 5....

Rotate Until Sorted

Hard
3 views 24 Jan 2026
Read n integers in a circle. In one move, rotate left by 1 (first element goes to end). Compute minimum moves to make array non-decreasing. If not possible, output -1....

Grid Walk with Obstacles

Hard
2 views 24 Jan 2026
You have a grid of size r x c. Start at (sr, sc). You get a command string of U, D, L, R. If a move goes outside grid, ignore it and count it as blocked. Output final position and blocked count....

Balanced Parentheses Early Fail

Hard
3 views 24 Jan 2026
Read a string of only '(' and ')', check if it is balanced. Output YES or NO. Stop early if you ever go negative balance....

Smallest Subarray Sum at Least S

Hard
2 views 24 Jan 2026
Read n integers (can be positive, zero) and target S. Compute the minimum length of a contiguous subarray with sum >= S. If not found, output 0....

Survive the Hits

Hard
2 views 24 Jan 2026
You start with L lives. You get q events: HIT x (lose x) or HEAL x (gain x). The moment lives becomes ...

First Repeat Prefix Sum

Hard
4 views 24 Jan 2026
Read n integers, find the earliest index i (1-based) where the prefix sum value has appeared before. If never repeats, output -1....

First Pair with Sum K

Hard
2 views 24 Jan 2026
Read n integers and target K, find the first pair in reading order that sums to K. Output their 1-based indices i j (i...

Run-Length Compression

Hard
3 views 24 Jan 2026
Read a string s (no spaces), compress it as char + count for each consecutive run. Example aaabb becomes a3b2. Output compressed string....

Kth Switch Toggle

Hard
3 views 24 Jan 2026
You have n bulbs all OFF. For i from 1 to n, toggle every i-th bulb. At the end, how many bulbs are ON? Output count....

Earliest Day to Reach Target

Hard
3 views 24 Jan 2026
You have daily gains array of n positive integers. Starting total=0, add day by day until total reaches or exceeds T. Output that day number (1-based). If never reaches, output -1....