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....
2 views
24 Jan 2026
Marks m are provided (0 to 100). Output PASS if m is at least 35, otherwise output FAIL....
4 views
24 Jan 2026
Read one integer n. Output its absolute value without using abs()....
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....
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....
3 views
24 Jan 2026
Read n integers. Count how many are divisible by 7 and output the count....
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....
4 views
24 Jan 2026
Read three integers a, b, c. Output the maximum using if-else logic....
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....
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)....
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....
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....
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....
2 views
24 Jan 2026
Read integer n, output PRIME if it is prime else NOT. Use loop up to sqrt and break early....
3 views
24 Jan 2026
Read two integers a and b. Compute gcd(a,b) using Euclid while loop and output it....
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....
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....
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....
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....
3 views
24 Jan 2026
Read n integers, sum the values at odd positions (1st, 3rd, 5th...) and output the sum....
2 views
24 Jan 2026
Read weight w (kg) and distance d (km). Charge rules: if w100 add extra 100. Output final charge....
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....
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....
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....
4 views
24 Jan 2026
Read n, find how many trailing zeros are in n factorial. Use loop dividing by 5....
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....
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....
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....
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....
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 ...
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....
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...
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....
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....
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....