4 views
25 Jan 2026
Given a sorted array and X, count pairs (i...
6 views
25 Jan 2026
Commands: PUSH x, POP, ROTATE k (move first to end k times). Print final queue (space-separated)....
7 views
25 Jan 2026
Given n intervals [l,r], find the maximum number of overlaps at any point....
3 views
25 Jan 2026
Write a gcd(a,b) function and print gcd for the given inputs....
3 views
25 Jan 2026
Create a function isPalindrome(s) that ignores spaces and case. Print YES or NO....
6 views
25 Jan 2026
Write a function that counts vowels in a string (a,e,i,o,u)....
5 views
25 Jan 2026
Write area(w,h) and print the rectangle area....
4 views
25 Jan 2026
Write a function reverseStr(s) and print the reversed string....
4 views
25 Jan 2026
Compute n! using recursion (n...
4 views
25 Jan 2026
Compute fib(n) with memoization (fib(0)=0, fib(1)=1)....
3 views
25 Jan 2026
Sort n strings by length, and for equal length sort lexicographically....
4 views
25 Jan 2026
Given x, apply f(x)=2x+1 two times and print the result....
3 views
25 Jan 2026
Given n numbers, use a function to square each and print the squared list....
4 views
25 Jan 2026
Write a function balanced(s) for () only. Print YES or NO....
4 views
25 Jan 2026
Given two sorted arrays, merge them using a function and print the merged list....
4 views
25 Jan 2026
Given a sorted array and q queries, use a function to binary search each query. Print 0-based index or -1....
4 views
25 Jan 2026
Given a postfix expression with integers and ops + - * /, evaluate it using helper functions....
5 views
25 Jan 2026
Create a counter() closure that returns 1,2,3,... each time it is called. Input q, print q lines of counts....
3 views
25 Jan 2026
Input x. Define f(x)=x+3 and g(x)=x*2. Compute g(f(x)) and f(g(x)) and print both....
5 views
25 Jan 2026
Given n and a list of swaps (i j), start with [1..n]. Apply swaps and print the final array....
5 views
25 Jan 2026
Given n words, group them by first letter (a-z) and print counts per letter present in sorted order....
5 views
25 Jan 2026
Given n numbers and k, print the k most frequent numbers. If frequencies tie, smaller number first....
8 views
25 Jan 2026
Given n intervals, merge overlaps and print the merged intervals sorted by start....
6 views
25 Jan 2026
Given n integers, print their sum....
4 views
25 Jan 2026
Print the maximum value in the array....
6 views
25 Jan 2026
Print the array in reverse order....
5 views
25 Jan 2026
Given n numbers and x, count how many times x appears....
5 views
25 Jan 2026
Given two arrays, print them concatenated....
5 views
25 Jan 2026
Remove duplicates but keep the first time each value appears....
4 views
25 Jan 2026
Rotate an array to the right by k positions....
4 views
25 Jan 2026
Answer q range-sum queries on an array....
4 views
25 Jan 2026
Find indices i and j such that a[i]+a[j]=target. Print first pair found, else -1 -1....
4 views
25 Jan 2026
Sort array values by frequency (desc), and by value (asc) when tie....
5 views
25 Jan 2026
Given two arrays, print unique common values in increasing order....
5 views
25 Jan 2026
You get n-1 numbers from 1..n. Find the missing number....
5 views
25 Jan 2026
Given n integers and k, find the longest subarray with sum exactly k....
4 views
25 Jan 2026
Print the maximum subarray sum (Kadane)....
5 views
25 Jan 2026
Count pairs i a[j]....
4 views
25 Jan 2026
Given array and window size k, print the maximum in each window....
5 views
25 Jan 2026
Given a permutation of 1..n, print minimum swaps to sort it....
4 views
25 Jan 2026
Find the k-th smallest value in the array (1-based k)....
4 views
25 Jan 2026
Check if the array can be split into three contiguous parts with equal sum. Print YES or NO....
5 views
25 Jan 2026
Given bar heights, find the largest rectangle area in the histogram....
5 views
25 Jan 2026
Print the reverse of the given string....
7 views
25 Jan 2026
Count vowels (a,e,i,o,u) in the string, case-insensitive....
4 views
25 Jan 2026
Capitalize the first letter of each word (words separated by spaces)....
4 views
25 Jan 2026
Check if the string is a palindrome ignoring spaces and case....
6 views
25 Jan 2026
Count how many words are in the string (words separated by spaces)....
6 views
25 Jan 2026
Compress the string using run-length encoding like a3b2....
5 views
25 Jan 2026
Print the first character that appears only once. If none, print -1....
4 views
25 Jan 2026
Given two strings, check if they are anagrams (ignore spaces, case-insensitive)....
4 views
25 Jan 2026
Remove duplicate characters but keep the first occurrence (spaces included)....
6 views
25 Jan 2026
Print the longest word in the line (if tie, print the first)....
4 views
25 Jan 2026
Check if b is a rotation of a (case-sensitive). Print YES or NO....
5 views
25 Jan 2026
Count how many times pattern p occurs in s (overlaps allowed)....
4 views
25 Jan 2026
Given n strings, print their longest common prefix (or empty)....
5 views
25 Jan 2026
Count how many times pattern p appears in s (overlaps allowed) using KMP....
4 views
25 Jan 2026
Find the length of the longest substring with all unique characters....
5 views
25 Jan 2026
Repeatedly remove adjacent equal characters. Print the final string....
5 views
25 Jan 2026
Print the length of the longest palindromic substring (expand-around-center)....
4 views
25 Jan 2026
Decode pattern like 3[a2[c]] -> accaccacc....
4 views
25 Jan 2026
Given s and p (lowercase), print all start indices where an anagram of p begins....
5 views
25 Jan 2026
Rearrange the string so that no two adjacent characters are the same. If not possible, print IMPOSSIBLE....
6 views
25 Jan 2026
Print a/b as integer. If b is 0, print DIVIDE_BY_ZERO....
5 views
25 Jan 2026
Given n integers and index i, print a[i] or OUT_OF_RANGE....
4 views
25 Jan 2026
If the token is not a valid integer (optional sign, digits only), print INVALID....
6 views
25 Jan 2026
Given a JSON object. If invalid, print INVALID_JSON. Else print how many keys it has....
7 views
25 Jan 2026
If date is valid (YYYY-MM-DD), print OK else INVALID_DATE....
6 views
25 Jan 2026
Given n numbers, print average with 2 decimals. If n=0, print EMPTY....
7 views
25 Jan 2026
Process q commands: PUSH x or POP. POP prints value, but if empty prints UNDERFLOW....
4 views
25 Jan 2026
You get n pairs a b. For each, print a/b as integer. If b=0 print ERROR....
4 views
25 Jan 2026
Given x, print floor(sqrt(x)). If x is negative, print ERROR....
4 views
25 Jan 2026
If age is between 0 and 120, print OK. Otherwise print INVALID_AGE....
5 views
25 Jan 2026
Input a b meaning a/b. If b=0 print ERROR. Else print reduced fraction p q....
5 views
25 Jan 2026
Print OK if input is valid IPv4 address (0..255 each part), else INVALID_IP....
6 views
25 Jan 2026
Given an integer as text, print it if it fits 32-bit signed, else print OVERFLOW....
6 views
25 Jan 2026
Input is a comma-separated list of integers. If any item is invalid, print ERROR, else print the maximum....
4 views
25 Jan 2026
Read lines KEY=VALUE. Count how many lines are invalid (missing '=', empty key). Print error count....
5 views
25 Jan 2026
Evaluate postfix expression. If it ever divides by zero or lacks operands, print ERROR....
6 views
25 Jan 2026
JSON object must contain keys id and name. Print OK, MISSING_KEYS, or INVALID_JSON....
4 views
25 Jan 2026
Given base b and string s, convert to decimal. If s contains invalid digit for base, print INVALID....
4 views
25 Jan 2026
Decode k[text]. If brackets are unbalanced or number is missing, print ERROR....
7 views
25 Jan 2026
Create a Rectangle class with width and height. Print area and perimeter....
6 views
25 Jan 2026
Make a Counter class with inc() and dec(). Process q commands INC or DEC and print final value....
7 views
25 Jan 2026
Create BankAccount with deposit/withdraw. Withdraw that goes below 0 is ignored. Print final balance....
8 views
25 Jan 2026
Create a Student class that stores marks and prints average with 2 decimals....
8 views
25 Jan 2026
Implement a Stack class with push/pop. POP on empty prints EMPTY. Print outputs for POP....
7 views
25 Jan 2026
Implement a Queue class with enqueue/dequeue. DEQ on empty prints EMPTY....
8 views
25 Jan 2026
Create Item with qty. Commands: ADD x, SELL x (cannot go below 0). Print final qty....
7 views
25 Jan 2026
Types: C r for circle, S a for square. Print area for each shape with 2 decimals....
7 views
25 Jan 2026
Make a Temperature class with setC(c) and getF(). Input c, print Fahrenheit with 2 decimals....
6 views
25 Jan 2026
Commands: ADD book, BORROW book, RETURN book. Track if a book is available. BORROW unavailable prints FAIL....
7 views
25 Jan 2026
Given a line, build a WordCounter object and print how many words it has....
8 views
25 Jan 2026
Capacity c. Commands: PUT k v, GET k. GET prints value or -1. Evict least recently used....
6 views
25 Jan 2026
Commands: UNION a b, FIND a b. FIND prints YES if connected else NO....
8 views
25 Jan 2026
Build an expression tree from postfix (+,-,*,/) and evaluate it....
5 views
25 Jan 2026
Commands: INSERT x, FIND x. Print YES/NO for FIND....
6 views
25 Jan 2026
Commands: ADD text, DEL k, UNDO. Print final text....
6 views
25 Jan 2026
Commands: ADD name score, TOP k. TOP prints top k names by score (desc), tie by name....
4 views
25 Jan 2026
Each non-empty line should look like LEVEL:message. LEVEL is INFO, WARN, or ERROR. Count each level and also count invalid lines. Print: info warn error invalid....
7 views
25 Jan 2026
Build a Playlist object and process commands: ADD song, REMOVE song, COUNT. Songs are unique by name. COUNT prints how many songs are in the playlist....
6 views
25 Jan 2026
You have an array of n integers. Support two operations: ADD i x (a[i]+=x) and SUM l r (inclusive). Print answers for SUM queries....
7 views
25 Jan 2026
Commands: ADD name p, POP. POP removes and prints the task with highest priority; if tie, the one added earlier. If empty, print EMPTY....
4 views
25 Jan 2026
Two integers a and b are given. Swap them without using a third variable and print the result....
5 views
25 Jan 2026
Given n, print the sum 1+2+...+n....
4 views
25 Jan 2026
Input is a temperature in Celsius. Print Fahrenheit with 2 decimals....
4 views
25 Jan 2026
You are given n and then n integers. Start total=0. Add each value and print final total....
6 views
25 Jan 2026
Given p r t, print simple interest (p*r*t/100) with 2 decimals....
4 views
25 Jan 2026
You will get q commands: SET x, GET. Keep a single variable (starts EMPTY). GET prints value or EMPTY....
4 views
25 Jan 2026
Commands: SET name value, GET name. Save values by name. GET prints value or NOT_FOUND....
4 views
25 Jan 2026
Line1 x. Line2 ops string. '+' means x++, '-' means x--. Print final x....
4 views
25 Jan 2026
Input has lines like KEY=VALUE. Ignore empty lines and lines starting with #. Print number of keys stored....
4 views
25 Jan 2026
Commands: LET x, BEGIN, END. Count how many LET shadows a name already present in an outer scope....
4 views
25 Jan 2026
Input: name value. Create a variable with that name and print it back....
4 views
25 Jan 2026
Given n numbers, print the running average after each number (2 decimals)....
5 views
25 Jan 2026
You get three integers a b c. Set x=a, y=&x, x=b, z=&y, y=c. Print x y z....
3 views
25 Jan 2026
Commands: SET name value, PRINT name. Count how many PRINT happen before a name is ever SET....
4 views
25 Jan 2026
Commands: SET name val, UNSET name, GET name. For GET print value or UNSET....
4 views
25 Jan 2026
You get a and b. Swap using XOR trick and print swapped....
5 views
25 Jan 2026
Commands: BEGIN, END, SET name value, GET name. GET searches inner to outer. Print value or NOT_FOUND....
5 views
25 Jan 2026
You get n pairs key value, then one text line. Replace {key} with value and print final text....
4 views
25 Jan 2026
Given q lines (CALL), print counter after each call using a static variable inside function....
4 views
25 Jan 2026
You get base key=value lines, then override key=value lines. Overrides replace base. Print final key count....
5 views
25 Jan 2026
A number is given as text. Print INT if it looks like an integer, otherwise FLOAT....
5 views
25 Jan 2026
Given a string, look at the first character. Print DIGIT, LETTER, or OTHER....
4 views
25 Jan 2026
You get an integer code (0..255). Print the character for it....
5 views
25 Jan 2026
Input is one token. Treat '', '0', and 'false' (case-insensitive) as false, everything else as true. Print TRUE or FALSE....
6 views
25 Jan 2026
Print the length of the given string (bytes)....
5 views
25 Jan 2026
Given n numeric tokens, count how many look like integers vs floats (contains '.' or exponent)....
6 views
25 Jan 2026
If the input is a valid integer text (optional sign, digits only) print the number, else print INVALID....
4 views
25 Jan 2026
Convert a binary string to decimal....
5 views
25 Jan 2026
Convert an integer to uppercase hexadecimal (no 0x prefix)....
4 views
25 Jan 2026
Given a line with mixed tokens, add only the numeric ones and print the sum. Print as integer if it is whole....
4 views
25 Jan 2026
Input like 1,234.50. Remove commas and print the number with 2 decimals....
5 views
25 Jan 2026
Given base b (2..36) and string s (digits/letters), convert to decimal....
5 views
25 Jan 2026
Two big non-negative integers are given as strings. Print their sum....
5 views
25 Jan 2026
Compare two big non-negative integers given as strings. Print , or =....
4 views
25 Jan 2026
Given a and b as big integers (a >= b), print a-b....
4 views
25 Jan 2026
Input a b c d meaning a/b + c/d. Print the reduced fraction p q....
4 views
25 Jan 2026
You get a big decimal integer as string. Convert it to binary....
5 views
25 Jan 2026
Convert a binary string (up to 500 bits) into a decimal string....
5 views
25 Jan 2026
Input x and k. Print x rounded to k decimals....
5 views
25 Jan 2026
Input big integer a and digit m (0..9). Print a*m....
4 views
25 Jan 2026
Given a and b, print a+b, a-b, and a*b on one line....
4 views
25 Jan 2026
Check if n is even or odd....
5 views
25 Jan 2026
Input x lo hi. Print x clamped inside [lo,hi]....
7 views
25 Jan 2026
Given a and b, print a & b....
4 views
25 Jan 2026
Print the bigger of two integers using a ternary expression....
6 views
25 Jan 2026
Swap two integers using XOR and print them....
5 views
25 Jan 2026
Print how many 1-bits are in n....
5 views
25 Jan 2026
Input n and k (0-based). Print 1 if kth bit is set, else 0....
4 views
25 Jan 2026
Input n and k (0-based). Flip kth bit and print new number....
5 views
25 Jan 2026
Given n integers, print XOR of all values....
4 views
25 Jan 2026
Input a b m. Print (a^b) mod m....
6 views
25 Jan 2026
Given n numbers, print bitwise OR of them....
5 views
25 Jan 2026
Input a and b (non-negative). Add them using bit operations only....
6 views
25 Jan 2026
Multiply a and b using only addition and bit shifts....
4 views
25 Jan 2026
Input a b (a>=0, b>0). Print quotient and remainder without using / or %....
3 views
25 Jan 2026
Expression tokens like: number op number op number. Evaluate strictly left-to-right (no precedence). Ops are + - *....
6 views
25 Jan 2026
Start with mask=0. Commands: GRANT k, REVOKE k, CHECK k. k is 0..30. CHECK prints 1/0....
5 views
25 Jan 2026
Given L and R, print XOR of all integers in [L,R]....
6 views
25 Jan 2026
Input a and b. Print how many bit flips to turn a into b....
5 views
25 Jan 2026
Input n. Print gray code g = n ^ (n>>1)....
4 views
25 Jan 2026
Given marks (0..100), print grade: A(90+), B(80-89), C(70-79), D(60-69), else F....
5 views
25 Jan 2026
Print YES if the year is a leap year, otherwise NO....
7 views
25 Jan 2026
Given a and b, print |a-b|....
4 views
25 Jan 2026
Given n, print n! using a loop....
4 views
25 Jan 2026
You get n and then n integers. Count how many are > 0....
5 views
25 Jan 2026
Print numbers 1..n, but print Fizz for multiples of 3, Buzz for multiples of 5, and FizzBuzz for both....
5 views
25 Jan 2026
Read integers until you see 0. Print the sum of numbers before 0....
5 views
25 Jan 2026
Given n, print PRIME if n is prime else NOT_PRIME....
4 views
25 Jan 2026
Print how many digits are in n (for n=0, answer is 1)....
6 views
25 Jan 2026
Starting from n, apply: if even n=n/2 else n=3n+1. Count steps to reach 1....
5 views
25 Jan 2026
Given n numbers and x, print the first number that is > x. If none, print -1....
5 views
25 Jan 2026
Given r and c and the matrix values, print the minimum value....
5 views
25 Jan 2026
Input is a string with (), [], {}. Print YES if it is balanced, else NO....
6 views
25 Jan 2026
Colors cycle: Red -> Green -> Yellow -> Red. Given start color and t steps, print final color....
4 views
25 Jan 2026
Start value=0. Commands: ADD x, SUB x, MUL x, DIV x (integer, ignore if x=0). Print final value....
6 views
25 Jan 2026
Given n integers, find the length of the longest strictly increasing contiguous run....
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....