Generate Parentheses Count

Hard
2 views 24 Jan 2026
Read n pairs. Using recursion function back(pos,open,close), count how many balanced strings are possible. Output count....

All Subset Sums

Hard
3 views 24 Jan 2026
Read n and n integers (n...

Fast Power Mod Function

Hard
3 views 24 Jan 2026
Read a b m, write function modpow(a,b,m) using binary exponent and output a^b mod m....

Merge Intervals

Hard
2 views 24 Jan 2026
Read n intervals [l,r]. Write function merge(intervals) and output merged intervals sorted....

Shortest Path BFS

Hard
2 views 24 Jan 2026
Read an undirected graph with n nodes and m edges and two nodes s and t. Use helper function bfs to output shortest distance (edges count) or -1....

Count Inversions

Hard
4 views 24 Jan 2026
Read n integers. Use function mergesort_count(arr) to return inversion count and output it....

Decode Function Calls

Hard
3 views 24 Jan 2026
Read n commands: PUSH x, POP, TOP. Use functions do_push, do_pop, do_top on a stack and output TOP outputs (or EMPTY)....

String Hash Queries

Hard
2 views 24 Jan 2026
Read a string s (lowercase) and q queries l r (1-based). Use helper function to build prefix hashes and answer hash values mod 1000000007....

Segment Tree Range Sum

Hard
3 views 24 Jan 2026
Read n integers and q queries. Two types: 1 i x means set a[i]=x, 2 l r means output sum of a[l..r] (1-based). Use functions build, update, query....

Sum of List

Easy
2 views 24 Jan 2026
Read n integers. Output the sum....

Min and Max

Easy
3 views 24 Jan 2026
Read n integers. Output minimum and maximum in one line....

Reverse List

Easy
2 views 24 Jan 2026
Read n integers. Output them in reverse order....

Count Positives

Easy
2 views 24 Jan 2026
Read n integers. Count how many are > 0 and output count....

Find First Index

Easy
2 views 24 Jan 2026
Read n integers and a target x. Output the first index (0-based) where x appears, else -1....

Remove All Occurrences

Easy
2 views 24 Jan 2026
Read n integers and value x. Remove all x and output remaining numbers. If nothing left output EMPTY....

Stack Operations

Easy
3 views 24 Jan 2026
Read q commands: PUSH x or POP. Start empty list. POP on empty does nothing. At end output size and last element (or EMPTY)....

Concatenate Two Lists

Easy
3 views 24 Jan 2026
Read two lists A and B. Output concatenated list A followed by B....

Check Sorted

Easy
2 views 24 Jan 2026
Read n integers. Output YES if list is non-decreasing else NO....

Adjacent Sums

Easy
2 views 24 Jan 2026
Read n integers. Build a new list of size n-1 where b[i]=a[i]+a[i+1]. Output b (or EMPTY if n...

Rotate List Right

Medium
2 views 24 Jan 2026
Read n integers and k. Rotate list to the right by k positions and output....

Swap Two Values

Easy
2 views 24 Jan 2026
Read two integers a and b. Swap them and output the swapped values. Use Python multiple assignment....

Prefix Sum Queries

Medium
2 views 24 Jan 2026
Read n integers and q queries l r (1-based). Output sum of each range....

Simple Interest

Easy
2 views 24 Jan 2026
Principal P, rate R (in percent), and time T (in years) are provided. Output simple interest = (P*R*T)/100. If result is integer, output without decimals else output up to 2 decimals....

Two Sum Exists

Medium
2 views 24 Jan 2026
Read n integers and target T. Output YES if there exist i...

Temperature Convert

Easy
2 views 24 Jan 2026
Celsius value C is provided. Convert to Fahrenheit F = C*9/5 + 32 and output with 2 decimals....

Run Length of Numbers

Medium
2 views 24 Jan 2026
Read n integers. Compress as pairs value count for consecutive equal values. Output pairs in new lines....

Last Digit and Sign

Easy
2 views 24 Jan 2026
Read one integer n. Output two things: last digit of |n| and the sign as NEG, ZERO, or POS....

Remove Duplicates Keep Order

Medium
3 views 24 Jan 2026
Read n integers. Remove duplicates but keep first occurrence order. Output the new list....

Seconds to HH:MM:SS

Easy
4 views 24 Jan 2026
Total seconds S is provided. Convert it to hh:mm:ss (00 padded) assuming 0 ...

Second Largest Distinct (Lists)

Medium
3 views 24 Jan 2026
Read n integers. Output the second largest distinct value, or NONE if not exists....

Area of Rectangle

Easy
3 views 24 Jan 2026
Read two numbers length L and width W. Output area L*W. Output without trailing zeros (like Python str())....

Longest Consecutive Ones

Medium
4 views 24 Jan 2026
Read n bits (0/1). Compute longest consecutive 1s length....

Update X with Operations

Easy
2 views 24 Jan 2026
Read two integers x and y. Do these updates in order: x=x+y, y=y+1, x=x-y. Output final x and y....

Subarray Sum Positive

Medium
2 views 24 Jan 2026
Read n positive integers and target S. Output YES if there exists a subarray with sum exactly S else NO....

Count Digits (No Strings)

Easy
2 views 24 Jan 2026
Read one integer n. Count number of digits in |n| without converting to string. For n=0 answer is 1....

Sort By Frequency

Medium
2 views 24 Jan 2026
Read n integers. Sort them by frequency ascending, if tie by value ascending. Output sorted list....

Build Full Name

Easy
2 views 24 Jan 2026
First name and last name are provided. Output as 'Last, First'....

Move Zeros To End

Medium
2 views 24 Jan 2026
Read n integers. Move all zeros to end keeping order of non-zeros. Output result....

Round to Nearest Multiple

Easy
5 views 24 Jan 2026
Input has two integers n and k are provided (k>0). Round n to nearest multiple of k. If exactly middle, round up....

Partition Around Pivot

Medium
2 views 24 Jan 2026
Read n integers and pivot x. Output list such that all x. Keep relative order inside each group....

Rotate Three Variables

Medium
3 views 24 Jan 2026
Read three integers a b c. Rotate left once: a...

Transpose Matrix

Medium
3 views 24 Jan 2026
Read r and c and then matrix. Output transpose matrix (c rows each has r numbers)....

Parallel Swaps

Medium
4 views 24 Jan 2026
Read n pairs (a,b). For each pair swap them and output. This is to practice variable assignment quickly....

Spiral Print Matrix

Medium
2 views 24 Jan 2026
Read r and c and a matrix. Output elements in spiral order....

Running Balance

Medium
3 views 24 Jan 2026
Read opening balance B and m operations. Each operation is: ADD x or SUB x. Output final balance....

Majority Element

Medium
2 views 24 Jan 2026
Read n integers. If an element appears more than n/2 times, output it else output NONE....

Min, Max, and Range

Medium
2 views 24 Jan 2026
Read n integers, output min, max, and (max-min). Use variables, one pass....

Kth Smallest Quickselect

Medium
4 views 24 Jan 2026
Read n integers and k (1-based). Compute kth smallest element using quickselect style and output it....

Second Largest Distinct

Medium
3 views 24 Jan 2026
Read n integers, find the second largest DISTINCT number. If it doesn't exist, output NONE....

LIS Length

Hard
2 views 24 Jan 2026
Read n integers. Output length of longest increasing subsequence....

Variable Store (SET/ADD/MUL)

Medium
2 views 24 Jan 2026
You will receive q commands on variable x: SET v, ADD v, MUL v. Start x=0. After all commands output x....

Sliding Window Maximum

Hard
3 views 24 Jan 2026
Read n integers and window size k. For each window output maximum. Use deque logic....

Two Variables Calculator

Medium
2 views 24 Jan 2026
You have two variables a and b starting at 0. You get q commands: SETA x, SETB x, ADDA x, ADDB x, SWAP. Output final a and b....

Largest Rectangle Histogram

Hard
3 views 24 Jan 2026
Read n bar heights. Compute the largest rectangle area in histogram and output it....

Linear Equation Solver

Medium
2 views 24 Jan 2026
Read a and b for equation a*x + b = 0. Output x as reduced fraction p/q. If no solution output NONE. If infinite solutions output ALL....

Trapping Rain Water

Hard
5 views 24 Jan 2026
Read n heights. Water trapped between bars should be calculated and printed....

Count Assignments to Same Variable

Medium
2 views 24 Jan 2026
You will receive n lines like 'x = value'. Count how many times the same variable name appears again (2nd time onwards). Output count....

Subarrays Sum Divisible

Hard
3 views 24 Jan 2026
Read n integers and k. Count subarrays whose sum is divisible by k....

Pack and Unpack

Medium
2 views 24 Jan 2026
One line has n and then n integers. Store them into variables: first, middle (all), last. Output first, count of middle elements, last....

Minimum Jumps

Hard
3 views 24 Jan 2026
Read n integers where a[i] is max jump length from i. Output minimum jumps from 0 to n-1 or -1 if not possible....

Normalize Score to 0..100

Medium
5 views 24 Jan 2026
You will receive integer score. If score is below 0 set to 0, if above 100 set to 100. Output final value....

Count Pairs With Difference K

Hard
3 views 24 Jan 2026
Read n integers and integer k. Count number of pairs (i...

Integer to Binary with Variables

Medium
2 views 24 Jan 2026
Read one integer n. Output its binary without using bin(). Use repeated division and variables....

Split Array Largest Sum

Hard
4 views 24 Jan 2026
Read n integers and m parts. Split array into m non-empty continuous parts to minimize the maximum part sum. Output that minimum possible value....

Make a Stable ID

Medium
2 views 24 Jan 2026
Read two integers userId and orderId, build an id string as userId-orderId with zero padding of orderId to 6 digits. Output the string....

Maximum Subarray Sum Circular

Hard
3 views 24 Jan 2026
Read n integers (can be negative). Compute maximum subarray sum in circular array and output it....

Integer Remainder Walk

Medium
3 views 24 Jan 2026
Read n and k. Start x=0. Repeat n times: x=(x+1) % k. Output x. This is a small variable-state walk....

Top K Frequent Elements

Hard
3 views 24 Jan 2026
Read n integers and k. Output k elements with highest frequency. If tie, smaller number first. Output in order of frequency desc then number asc....

Find First Unset Variable

Hard
2 views 24 Jan 2026
You will receive q queries like GET name or SET name value. Maintain variables in a dict. For each GET, output value if present else UNSET....

Person Greeting

Easy
2 views 24 Jan 2026
Name and age are provided. Create class Person with method greet() that returns 'Hi , you are '. Output greet()....

Mini Scope Shadow Counter

Hard
3 views 24 Jan 2026
Read a tiny language with commands: 'let x', 'block', 'end'. Each block makes a new scope. Count how many times a let shadows a variable from an outer scope....

Rectangle Area

Easy
2 views 24 Jan 2026
Length and width are provided. Create Rectangle class with area() method. Output area as integer....

Dependency Assignments

Hard
2 views 24 Jan 2026
You will receive n assignments like x = y + 5 or x = 10. Variables are single lowercase letters. Compute final values for all variables that appear on left side, assuming missing variables start at 0....

Bank Balance

Easy
2 views 24 Jan 2026
You have a bank account with starting balance B. Then q commands: DEP x, WIT x (withdraw, but if not enough keep same). Output final balance....

Parallel Assignment Simulator

Hard
2 views 24 Jan 2026
You have two variables a and b. For each step you get newA and newB expressions in terms of old a and b: 'A' means old a, 'B' means old b, or an integer. Apply parallel assignment each step (both upda...

Simple Counter

Easy
2 views 24 Jan 2026
You have q commands: INC, DEC. Create Counter class. DEC cannot go below 0. Output final value....

Update With Mod and Big Numbers

Hard
2 views 24 Jan 2026
Read q operations on x starting with 0. Operations are ADD v, MUL v, and MOD m. Values can be large. Use big integers safely and output final x....

Student Average

Easy
2 views 24 Jan 2026
Read n marks. Create Student class with method avg(). Output average with 2 decimals....

Detect Uninitialized Read

Hard
3 views 24 Jan 2026
You will receive n statements in a tiny language: 'set x v' or 'add x y' meaning x = x + y. If add uses a variable that was never set before (for x or y), count it as a bad read. Output badReadCount....

Point Distance

Easy
2 views 24 Jan 2026
Read two integers x and y. Create Point class with method dist0() giving distance from origin. Output with 3 decimals....

Top K Variables by Value

Hard
2 views 24 Jan 2026
You will receive n variables with values. Output the top k variables by value (desc), tie by name (asc). Each name is a string without spaces....

Book Thick Check

Easy
2 views 24 Jan 2026
Title (no spaces) and pages are provided. Create Book class with method thick() that returns YES if pages>300 else NO....

Rolling Hash Variable

Hard
2 views 24 Jan 2026
Read a string s and integer base B and mod M. Compute rolling hash: h=0; for each char c: h=(h*B+ord(c))%M. Output h....

Temperature Convert Class

Easy
2 views 24 Jan 2026
Celsius value is provided. Create Temperature class with method to_f(). Output Fahrenheit with 2 decimals....

Multiple Counters Summary

Hard
2 views 24 Jan 2026
Read n words. Maintain two counters: vowelStart and consonantStart. Increment depending on first letter of each word. Output both counts....

Car Fuel Check

Easy
2 views 24 Jan 2026
Distance d, mileage m (km per litre) and fuel f are provided. Create Car class can_reach(d) returns YES if fuel enough else NO....

Add Minutes on Clock

Medium
2 views 24 Jan 2026
Time is provided as hour (0-23) and minute (0-59). Also an integer k (can be big) is provided. Add k minutes to the time and output the new time in HH:MM format....

Stack Class

Easy
2 views 24 Jan 2026
You will receive q commands: PUSH x, POP, TOP. Create Stack class and for TOP output value or EMPTY....

Variable X with SNAP and ROLLBACK

Hard
3 views 24 Jan 2026
You have one variable x starting at 0. You get q commands: SET v, ADD v, MUL v, SNAP, ROLLBACK. SNAP saves current x. ROLLBACK restores x to the last saved SNAP and removes that SNAP. If there is no S...

Inventory Total Cost

Medium
2 views 24 Jan 2026
Read n items each with name, price, qty. Create Item class with total() method. Output grand total cost....

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....

Sort Circles By Area

Medium
4 views 24 Jan 2026
Read n radii. Create Circle class with area() and sort circles by area ascending. Output sorted radii....

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....

Time Add Seconds

Medium
2 views 24 Jan 2026
Time hh mm ss and extra seconds x are provided. Create Time class add(x) and output new time in HH:MM:SS (24h)....

Absolute Without abs

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

Employee Yearly Salary

Medium
3 views 24 Jan 2026
Read monthly salary and bonus percent. Create Employee class yearly() to return yearly salary with bonus included. Output as integer....

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....

Fraction Add

Medium
2 views 24 Jan 2026
Read two fractions a/b and c/d. Create Fraction class that reduces and supports add. Output result as p q reduced....

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....

Matrix Sum

Medium
2 views 24 Jan 2026
Read r c and two matrices. Create Matrix class with add method. Output resulting matrix....

Count Multiples of 7

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

Task Tracker

Medium
2 views 24 Jan 2026
You will receive q commands: ADD name, DONE name, COUNT. Create TaskTracker class. COUNT prints how many tasks are pending....

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....

Group Scores

Medium
6 views 24 Jan 2026
Read n entries name score. Create Player class and group by name summing scores. Output names sorted with total score....

Max of Three Numbers

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

Shopping Cart

Medium
2 views 24 Jan 2026
You will receive q commands: ADD item price, REMOVE item, TOTAL. Create Cart class. TOTAL prints sum of prices of current items....

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....

Queue With Two Stacks

Medium
3 views 24 Jan 2026
You will receive q commands: ENQ x, DEQ, FRONT. Create Queue class using two stacks. FRONT prints front value or EMPTY....

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)....

URL Parts

Medium
2 views 24 Jan 2026
One URL string like domain/path is provided (no spaces). Create URL class with domain() and path() methods. If no '/', path is EMPTY....

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....

Password Rules

Medium
2 views 24 Jan 2026
Read a password string. Create Validator class ok() that checks: length>=8, has at least one digit, one uppercase, one lowercase. Output YES or NO....

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....

Polynomial Evaluate

Medium
2 views 24 Jan 2026
Read degree n, then n+1 coefficients from highest to constant, and x. Create Polynomial class eval(x). Output value....

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....

Min Stack Class

Hard
2 views 24 Jan 2026
You will receive q commands: PUSH x, POP, MIN. Create MinStack class and for MIN output current minimum or EMPTY....

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....

LRU Cache Class

Hard
4 views 24 Jan 2026
Cache capacity cap is provided and q commands: PUT k v, GET k. Implement LRUCache class. For GET output value or -1....

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....

Graph Shortest Path Class

Hard
3 views 24 Jan 2026
Read n m edges and s t. Create Graph class with bfs(s,t) method. Output shortest distance or -1....

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....

Calendar Conflicts

Hard
3 views 24 Jan 2026
Read n meetings as start end. Create Calendar class add(start,end) returns YES if added else NO (conflict if overlap). Output results for each add....

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....

Nested Store Class

Hard
2 views 24 Jan 2026
You will receive q commands: SET path value, GET path. Path is dot separated. Create Store class to handle. For GET output value or NOT FOUND....

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....

Sparse Vector Dot Product

Hard
2 views 24 Jan 2026
Two sparse vectors are provided as list of index:value pairs. Build SparseVector class with dot(other). Output dot product....

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....

Complex Numbers Sum and Product

Medium
4 views 24 Jan 2026
Read two complex numbers as a b and c d, meaning (a+bi) and (c+di). Create Complex class with add and mul. Output sum then product as 'x y' for real and imag....

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....

Email Normalizer

Medium
2 views 24 Jan 2026
Read n email strings. Create Email class that normalizes (lowercase, trim spaces). Output count of unique normalized emails....

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....

Connectivity Queries (DSU)

Hard
2 views 24 Jan 2026
Read n and q queries. Make DSU class with find and union. Queries: UNION u v, ASK u v. For ASK output YES if connected else NO....

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....

Trie Prefix Counter

Hard
3 views 24 Jan 2026
Read q operations: ADD word or COUNT prefix. Create Trie class. For COUNT output how many added words have this prefix....

Ways to Reach N

Medium
3 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....

Median Finder Class

Hard
3 views 24 Jan 2026
You will receive q commands: ADD x or MEDIAN. Create MedianFinder class using two heaps. For MEDIAN output lower median (floor for even count)....

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....

Segment Tree Range Minimum

Hard
3 views 24 Jan 2026
Read n numbers and q queries. Build SegmentTree class with update(i,x) and query(l,r) returning minimum. Output query answers....

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....

Safe Integer Parse

Easy
2 views 24 Jan 2026
Input is a single token. If it can be converted to integer, output it. Otherwise output 0....

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....

Sum Two Numbers Safely

Easy
3 views 24 Jan 2026
Read two tokens. If both are integers, output their sum. If any is missing or not an integer, output ERROR....

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....

Safe Integer Division

Easy
2 views 24 Jan 2026
Read two integers a and b. Output a//b. If b is 0 output DIVIDE BY ZERO. If input is not valid, output ERROR....

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....

Safe Modulo

Easy
2 views 24 Jan 2026
Read two integers a and b. Output a%b. If b is 0 output DIVIDE BY ZERO. If input is invalid, output ERROR....

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....

Pick Element By Index

Easy
3 views 24 Jan 2026
Read n integers and an index i (0-based). Output a[i]. If i is outside range or input is invalid, output OUT OF RANGE....

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 ...

Parse HH:MM to Minutes

Easy
2 views 24 Jan 2026
Time string is provided in HH:MM. Output minutes since 00:00. If format is wrong or values are out of range, output INVALID....

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....

Character At Position

Easy
2 views 24 Jan 2026
String s and position p are provided (0-based). Output character at that position. If p is not integer or out of range, output INVALID....

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...

Perfect Square Check Safely

Easy
4 views 24 Jan 2026
Input is a single token. If it is a non-negative integer and perfect square output YES else NO. If input is invalid output NO....

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....

Safe Power (Non-negative Exponent)

Easy
4 views 24 Jan 2026
Read two integers a and b. Output a^b modulo 1000000007. If b is negative or input invalid, output ERROR....

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....

Safe Float Print

Easy
2 views 24 Jan 2026
Input is a single token. If it is a number, output it with 2 decimals. Else output 0.00....

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....

One Operator Calculator

Medium
2 views 24 Jan 2026
Expression is provided as: a op b (space-separated). op can be + - * / %. Division is integer division. If op is invalid or division by zero happens, output ERROR....

Value Type Finder

Easy
6 views 24 Jan 2026
Read one token. Decide its data type using simple rules: True/False is BOOL, signed digits is INT, number with dot is FLOAT, otherwise STRING. Output the type name....

Count Valid Integers

Medium
3 views 24 Jan 2026
Read n tokens (may contain junk). Count how many tokens are valid integers and output the count....

String Number Add

Easy
3 views 24 Jan 2026
A number is provided as a string x and an integer y is provided. Convert x to int and output x+y....

Sum of Valid Integers

Medium
2 views 24 Jan 2026
Read n tokens. Add only those tokens that are valid integers. Output the sum (0 if none valid)....

Half Up Rounding

Easy
2 views 24 Jan 2026
A decimal number x is provided. Round it to nearest integer (0.5 goes away from zero) and output the integer....

Multiply Valid Integers (Mod)

Medium
4 views 24 Jan 2026
Read n tokens. Multiply only valid integers and take modulo 1000000007. If no valid integers, output 0....

Character Code

Easy
2 views 24 Jan 2026
One character ch is provided. Output its ASCII/Unicode code using ord()....

Base to Decimal Safely

Medium
2 views 24 Jan 2026
Read a string num and base b (2 to 36). Convert num to decimal and output it. If conversion fails, output INVALID....

Code to Character

Easy
2 views 24 Jan 2026
Input has one integer code is provided (0 to 127). Output the character using chr()....

Validate IPv4 Address

Medium
4 views 24 Jan 2026
Read a string, check if it is a valid IPv4 like A. B.C.D where each part is 0 to 255 and no empty parts. Output YES or NO....

Repeat With Dash

Easy
2 views 24 Jan 2026
Word w and integer n are provided. Output w repeated n times, joined with '-' (dash). If n is 0 output empty....

Safe Range Sum Queries

Medium
2 views 24 Jan 2026
Read n numbers and q queries l r (0-based inclusive). For each query output sum. If query is out of range or invalid, output ERROR for that query....

Flip Bit

Easy
2 views 24 Jan 2026
Read integer b (0 or 1), flip it (0 becomes 1 and 1 becomes 0). Output flipped value....

Stop At First Bad Number

Medium
2 views 24 Jan 2026
Read a list of tokens ending with END. Start sum=0. Add each token as integer. If a token is not integer (and not END), output BAD and stop. If all good, output sum....

Only Digits Check

Easy
3 views 24 Jan 2026
String s is provided (no spaces). Output YES if all characters are digits, else NO....

Command Processor With Errors

Medium
3 views 24 Jan 2026
You will receive q commands: ADD x, SUB x, MUL x. Start value=0. If any command has invalid number or unknown op, output ERROR at line i (1-based) and stop. Else output final value....

Make Initials

Easy
3 views 24 Jan 2026
Three words are provided: first, middle, last. Output initials like R.K.S (with dots)....

Recover Missing Matrix Cells

Medium
3 views 24 Jan 2026
Read r c and then r lines of matrix. Some lines may have less than c numbers. Treat missing cells as 0. Output sum of each column....

Division With 4 Decimals

Easy
3 views 24 Jan 2026
Input has two integers a and b are provided (b is not 0). Output a/b with exactly 4 digits after decimal....

Parse Phone Number Digits

Medium
2 views 24 Jan 2026
A phone number string is provided. Extract only digits and output them. If there are no digits, output INVALID....

Count Token Types

Medium
4 views 24 Jan 2026
Read n tokens. Each token can be: signed int, float (with dot), True/False, NONE, or a word. Count how many INT, FLOAT, BOOL, NONE, and WORD tokens and output counts in this order....

Safe Average of Integers

Medium
2 views 24 Jan 2026
Read n tokens. Consider only valid integers, compute average and output floor value. If no valid integer, output 0....

Sum Mixed Numbers

Medium
5 views 24 Jan 2026
Read n values, each value is either integer or float (contains dot). Sum them and output result with exactly 3 decimals....

Key Value Store (Ignore Bad Lines)

Medium
3 views 24 Jan 2026
Read n lines with format key=value. Some lines may not have '=' or may be empty, ignore them. Then q queries keys. For each query output value or NOT FOUND....

Bit Length of Big Integer

Medium
2 views 24 Jan 2026
Input has one integer n is provided (can be very large). Output how many bits are needed to represent |n| in binary. For n=0 output 1....

Validate Date dd-mm-yyyy

Medium
4 views 24 Jan 2026
Date string is provided as dd-mm-yyyy. Output VALID if it is a real date (with leap year rules) else INVALID....

Compare Floats with Epsilon

Medium
4 views 24 Jan 2026
Read two floats a and b. If |a-b| < 1e-9 output EQUAL. Else output GREATER if a>b else SMALLER....

Decode Simple RLE

Medium
3 views 24 Jan 2026
Read string like a2b3c1 meaning aa bbb c. Output decoded string. If format is invalid (missing count or non-digit count), output ERROR....

Hex to Decimal

Medium
3 views 24 Jan 2026
Hex string h is provided (without 0x). Convert it to decimal integer and output it....

Mini Calculator With Parentheses

Hard
3 views 24 Jan 2026
Expression contains integers, + - * / and parentheses. Division is integer division. If expression is invalid or division by zero occurs, output ERROR, else output result....

Decimal to Hex

Medium
3 views 24 Jan 2026
Read one integer n. Output its lowercase hexadecimal representation without 0x....

Transaction Store With Rollback

Hard
2 views 24 Jan 2026
You will receive q commands: BEGIN, COMMIT, ROLLBACK, SET k v, GET k. Implement nested transactions. GET prints value or NOT FOUND. If COMMIT/ROLLBACK is invalid, output ERROR and stop....

Binary XOR

Medium
3 views 24 Jan 2026
Two binary strings a and b are provided (same length). Compute bitwise XOR and output result without leading zeros (output 0 if all zero)....

Total Amount and Bad Lines

Hard
2 views 24 Jan 2026
Read n lines, each should be 'name amount'. amount must be integer. Sum valid amounts and count bad lines. Output total and badCount....

Complex Number Multiply

Medium
3 views 24 Jan 2026
Read a b c d, treat them as complex numbers (a+bi) and (c+di). Multiply them and output real and imag parts....

Robust Component Count

Hard
3 views 24 Jan 2026
Read n m and then m edges. Some edge lines may be broken or have nodes out of range. Ignore invalid edges. Output number of connected components in resulting graph....

UTF-8 Bytes Info

Medium
2 views 24 Jan 2026
A line string s is provided (can contain spaces). Convert it to UTF-8 bytes. Output two integers: byteLength and checksum (sum of bytes modulo 256)....

Safe Polynomial Parser

Hard
3 views 24 Jan 2026
Read expression like 'a0 a1 a2... an | x'. Left side are ints separated by spaces. If any coefficient is invalid, output ERROR. Else evaluate polynomial at x using Horner and output....

Sum With Bad Tokens

Medium
3 views 24 Jan 2026
Read n tokens. If token is a valid signed integer, add it to sum. Otherwise ignore it. Output the sum....

Batch Division With Line Errors

Hard
2 views 24 Jan 2026
First line q. Next q lines have a b. For each line output a//b. If b is 0 or parsing fails, output ERROR for that line....

Money Format Half Up

Medium
4 views 24 Jan 2026
Amount is provided as string like 12, 12.3, 12.345. Output it in money format with 2 decimals using normal rounding (half up)....

Strict Brackets Validator

Hard
2 views 24 Jan 2026
Read a string containing brackets only: ()[]{}. If any other char is present, output ERROR. Else if brackets are balanced output YES else NO....

Remove Surrounding Quotes

Medium
3 views 24 Jan 2026
A string s is provided. If it starts and ends with double quote, remove those two quotes. Otherwise output as it is....

Validate and Fix Coordinates

Hard
2 views 24 Jan 2026
Read n coordinate pairs. Each line should contain x y integers. If a line is invalid, treat it as 0 0. Output total distance travelled from (0,0) visiting points in order (Manhattan)....

Convert Token to Flag

Medium
2 views 24 Jan 2026
Input is a single token t is provided. If t is True output 1, if False output 0, if NONE output NULL. Otherwise output t unchanged....

Top K Sum From Mixed Tokens

Hard
2 views 24 Jan 2026
Read n tokens and integer k. Consider only tokens that are valid integers. If there are less than k valid integers, output ERROR. Else output sum of k largest valid integers....

Normalize Scientific Notation

Medium
3 views 24 Jan 2026
A number is provided as a string, it may be in scientific notation like 1e3 or 2.50E-1. Output it as normal decimal without exponent and remove extra trailing zeros....

Deque Commands With Errors

Hard
3 views 24 Jan 2026
You will receive q commands: PUSHFRONT x, PUSHBACK x, POPFRONT, POPBACK. Start empty. On POP when empty, output ERROR and stop. Else after all commands output final deque as space-separated or EMPTY....

First Adjacent Different Type

Medium
5 views 24 Jan 2026
Read n tokens, find the first adjacent pair (i,i+1) which have different inferred type using rules: BOOL, INT, FLOAT, WORD. Output i (1-based) or -1 if all adjacent types are same....

Repeat a Line N Times

Easy
5 views 24 Jan 2026
Read n and a text line a, output the same line a exactly n times (each on new line)....

Normalize Number String

Hard
2 views 24 Jan 2026
A number is provided as string. It may have + sign, leading zeros, and decimal part. Normalize it: remove +, remove extra leading zeros, remove trailing zeros in decimal, and if it becomes -0 or 0.0 t...

Squares From 1 to N

Easy
3 views 24 Jan 2026
Read n, output square of every number from 1 to n, one per line....

Sum Numbers With Prefix Base

Hard
3 views 24 Jan 2026
Read n tokens. Each token can be decimal like 15, binary like 0b1010, octal like 0o12, or hex like 0xFF. Tokens can also have a leading '-' sign. Convert all to integer and output the sum....

Batch Sum (T Testcases)

Easy
3 views 24 Jan 2026
First number t is provided. For each testcase, two integers a and b are provided. Output a+b for each testcase....

Add Fractions Reduced

Hard
4 views 24 Jan 2026
Two fractions are provided as p/q form. Add them and output result in reduced form p/q with q positive....

Count Digits In Each Line

Easy
3 views 24 Jan 2026
Read t lines. For each line, count how many characters are digits (0-9) and output the count....

Unescape Simple String

Hard
3 views 24 Jan 2026
A quoted string is provided. It can contain escapes: \\\\n, \\\\t, \\\\\\\\, and \\\\\. Unescape it and output two integers: length and checksum (sum of char codes modulo 256)."....

Reverse Number For Each Test

Easy
4 views 24 Jan 2026
Read t integers. For each number, reverse its digits and keep the sign. Example -120 becomes -21....

JSON Type Counter

Hard
3 views 24 Jan 2026
A JSON array is provided in one line, like [1,2,true,null]. Count how many numbers, strings, booleans, and null values. Output counts in order: num str bool null....

Even Or Odd Batch

Easy
4 views 24 Jan 2026
Read t integers. Output EVEN if number is even else ODD for each testcase....

Pack Bytes to Hex

Hard
3 views 24 Jan 2026
Read n and then n integers (0..255). Put them into a bytes object and output hex string in uppercase....

Trim Length For Each Line

Easy
4 views 24 Jan 2026
Read t lines. For each line, remove leading and trailing spaces and output the length of the remaining text....

Type Aware Reduce

Hard
2 views 24 Jan 2026
Read n values (each is int or float with dot). If all are integers, output PRODUCT as integer. Otherwise output SUM as float with 2 decimals....

Min Of Three (T Times)

Easy
4 views 24 Jan 2026
For each testcase you get three integers. Output the minimum among them....

Compare Complex Magnitudes

Hard
2 views 24 Jan 2026
Two complex numbers are provided as a b and c d (a+bi and c+di). Output FIRST if first magnitude is bigger, SECOND if second bigger, else EQUAL....

Right Triangle Star Print

Easy
5 views 24 Jan 2026
Read n, output a right triangle of stars. Line i has i stars (1 to n)....

Decimal Drift Simulator

Hard
2 views 24 Jan 2026
Read x and n. Repeat n times: x = round(x,2) + 0.1 (decimal rounding half up). Output final x with exactly 2 decimals....

Prefix Sums Print

Easy
3 views 24 Jan 2026
Read n numbers. Output prefix sum after each element (same order)....

Sort Mixed Tokens

Hard
2 views 24 Jan 2026
Read n tokens. Token types: INT, FLOAT (with dot), WORD. Sort by type order INT then FLOAT then WORD. For ints sort by numeric value, for floats sort by numeric value, for words sort lexicographically...

Batch GCD

Medium
5 views 24 Jan 2026
Read t pairs a b. For each pair output gcd(a,b)....

Phonebook Lookup

Easy
3 views 24 Jan 2026
Read n entries of name and phone. Then one query name is provided. Output the phone if present else output NOT FOUND....

Check Array Sorted For Each Case

Medium
4 views 24 Jan 2026
Read t testcases. Each testcase has n and array. Output YES if array is non-decreasing else NO....

Unique Words Count

Easy
3 views 24 Jan 2026
A line sentence is provided. Words are separated by spaces. Count how many unique words are there and output the count....

Rotate String Right

Medium
4 views 24 Jan 2026
For each testcase you get string s and integer k. Rotate string to the right by k and output the new string....

Last Value for Key

Easy
4 views 24 Jan 2026
Read n pairs key value. If a key appears many times, keep the last value. After all pairs, output value for query key, or NA if key never appeared....

Unique Words Count (Case-Insensitive)

Medium
5 views 24 Jan 2026
For each testcase you get a full line sentence. Count unique words ignoring case and output the count....

Sum of Dictionary Values

Easy
3 views 24 Jan 2026
Read n pairs key and integer value. Add all values and output total sum. Keys may repeat, still add every time....

First Non-Repeating Character Index

Medium
4 views 24 Jan 2026
For each testcase you get string s. Output index (0-based) of first character that appears exactly once. If none, output -1....

Key Exists

Easy
2 views 24 Jan 2026
Read n keys (one per line). Then query key is provided. Output YES if query exists else NO....

Sliding Window Maximum (for _ in range(n): print(a))

Medium
4 views 24 Jan 2026
For each testcase you get n, k and n numbers. Output max of each window of size k (space-separated)....

Digit Frequency

Easy
3 views 24 Jan 2026
A string of digits is provided. Count frequency of each digit 0 to 9 and output 10 integers in one line....

Longest Increasing Prefix Length

Medium
4 views 24 Jan 2026
For each testcase you get n numbers. Compute length of the longest prefix that is strictly increasing....

Count By First Letter

Easy
2 views 24 Jan 2026
Read n words. Count how many words start with each first letter. Output results sorted by letter as: letter count each on new line....

Range Sum Queries Per Testcase

Medium
4 views 24 Jan 2026
Each testcase has n numbers and q queries (l r, 1-based). Output sum for each query....

Merge Two Score Lists

Easy
3 views 24 Jan 2026
Read n pairs in list A and m pairs in list B (key and score). Make final score for each key as sum of scores from both lists (missing is 0). Output keys sorted with their final score....

Sort By Frequency (for _ in range(n): print(a))

Medium
3 views 24 Jan 2026
For each testcase you get n integers. Sort them by frequency descending. If frequency same, smaller number first. Output sorted list....

Key With Maximum Value

Easy
3 views 24 Jan 2026
Read n pairs key value (integer). Compute the key with maximum value. If tie, pick lexicographically smallest key. Output the key....

Find Missing And Duplicate

Medium
6 views 24 Jan 2026
For each testcase you get n and array of size n with numbers 1..n, but one number is missing and one is repeated. Output missing and duplicate....

Word Frequency Table

Medium
2 views 24 Jan 2026
Read n words (one per line). Output each distinct word with its count, sorted by word....

Remove Adjacent Duplicates

Medium
4 views 24 Jan 2026
For each testcase you get string s. Repeatedly remove adjacent equal characters using a stack idea. Output final string (or EMPTY)....

Top K Frequent Words

Medium
3 views 24 Jan 2026
Read n words and integer k. Output top k words by frequency (desc), tie by word (asc)....

Two Sum Indices

Medium
4 views 24 Jan 2026
For each testcase you get n, target and n integers. Output first pair indices i j (0-based) such that a[i]+a[j]=target. If not found output -1 -1....

Ledger with GET

Medium
2 views 24 Jan 2026
You have a dictionary of balances. Commands: ADD name x, SUB name x, GET name. Missing name starts at 0. For GET, output current balance....

Count By Remainders

Medium
3 views 24 Jan 2026
For each testcase you get n, m and n integers. Count how many numbers give remainder 0..m-1 when divided by m. Output counts in one line....

First Non-Repeating Word

Medium
2 views 24 Jan 2026
Read n words in order. Output the first word that appears exactly once. If none, output NONE....

Intersection Of Two Sorted Arrays

Medium
5 views 24 Jan 2026
For each testcase you get two sorted arrays. Output unique common elements in increasing order (space-separated) or EMPTY....

Count Pairs with Same Value

Medium
3 views 24 Jan 2026
Read n keys with integer values. Count how many unordered pairs of keys have same value. Output the number....

Kth Largest Element

Medium
3 views 24 Jan 2026
For each testcase you get n, k and n integers. Output the k-th largest element....

Anagram Group Count

Medium
4 views 24 Jan 2026
Read n words. Two words are anagrams if their letters can be rearranged. Count how many distinct anagram groups are there and output it....

Range Add Queries (Difference Array)

Hard
4 views 24 Jan 2026
For each testcase you get n and q updates. Each update adds val to all positions l..r (1-based). After all updates output final array....

First Index Map

Medium
2 views 24 Jan 2026
Read n integers. Store the first index (1-based) for each distinct value. Then q queries follow, each query is a value. Output its first index or -1....

Count Subarrays With XOR K

Hard
4 views 24 Jan 2026
For each testcase you get n, k and n integers. Count number of subarrays whose XOR is exactly k....

Counter with Delete

Medium
3 views 24 Jan 2026
You have q commands: INC key, DEC key. Start counts at 0. If after DEC the count becomes 0, remove the key from dictionary. At end output number of keys left....

Minimum Jumps To Reach End

Hard
5 views 24 Jan 2026
For each testcase you get array where a[i] is max jump length from i. Compute minimum jumps to reach last index, else -1....

Intersection of Keys

Medium
2 views 24 Jan 2026
Read two dictionaries A and B as lists of keys. Output how many keys are present in both....

Dijkstra Shortest Path (Many Cases)

Hard
4 views 24 Jan 2026
For each testcase you get weighted undirected graph. Output shortest distance from 1 to n. If unreachable output -1....

Parse Key:Value Pairs

Medium
2 views 24 Jan 2026
One line has pairs like key:value separated by spaces. Build dictionary and output how many pairs were parsed and sum of all integer values....

Fast Fibonacci Mod

Hard
3 views 24 Jan 2026
For each testcase you get n. Output Fibonacci(n) modulo 1000000007. Use fast doubling so big n is also ok....

Prefix Count Queries

Medium
3 views 24 Jan 2026
Read n words. For each word, count all its prefixes. Then q prefixes are provided. For each prefix output how many words start with it....

Distinct In Every Window

Hard
3 views 24 Jan 2026
For each testcase you get n, k and n integers. For each window of size k output how many distinct numbers are inside....

Evaluate Simple Expression

Medium
2 views 24 Jan 2026
Read n assignments like name value (integer). Then one expression is provided as: name1 op name2 where op is + or -. Output result using stored values. Missing names are treated as 0....

Longest Palindromic Subsequence Length

Hard
4 views 24 Jan 2026
For each testcase you get string s. Output length of longest palindromic subsequence....

Reverse Map Count

Medium
2 views 24 Jan 2026
Read n pairs key value. Build reverse mapping: for each value, how many keys map to it. Output values sorted with their counts....

Largest Rectangle In Histogram

Hard
4 views 24 Jan 2026
For each testcase you get n bar heights. Compute largest rectangle area in histogram....

Rename Key Safely

Medium
2 views 24 Jan 2026
Read q operations: SET k v, RENAME old new. RENAME works only if old exists and new does not exist. At end output number of keys and then keys sorted....

Tree Diameter For Each Testcase

Hard
3 views 24 Jan 2026
For each testcase you get a tree with n nodes. Output the diameter length (number of edges on longest path)....

Count Subarrays Sum K

Hard
3 views 24 Jan 2026
Read n integers and target K. Count number of subarrays with sum exactly K. Output the count....

Topological Order Or Cycle

Hard
5 views 24 Jan 2026
For each testcase you get a directed graph. If topological order exists, output one order. If cycle exists, output CYCLE....

Longest Subarray with At Most K Distinct

Hard
3 views 24 Jan 2026
Read n integers and K. Compute length of the longest contiguous subarray that has at most K distinct numbers....

Smallest Window Contains Pattern

Hard
3 views 24 Jan 2026
Read string s and pattern p (both no spaces). Compute the length of smallest substring of s that contains all characters of p with at least same counts. If not possible output 0....

LRU Cache Simulator

Hard
2 views 24 Jan 2026
You have cache capacity cap. Commands: GET key, PUT key value. For GET output value if present else -1. LRU eviction is used when capacity exceeded....

Nested Dictionary Path

Hard
3 views 24 Jan 2026
You will receive q commands on a nested dictionary: SET path value, GET path. Path is dot separated like a.b.c. For GET output value if exists else NOT FOUND....

Inventory Commands

Hard
3 views 24 Jan 2026
You have an inventory counts dictionary. Commands: ADD item x, REMOVE item x, COUNT item. Missing item starts at 0. REMOVE cannot make count below 0 (stop at 0). For COUNT output current count....

First Unique Number Stream

Hard
2 views 24 Jan 2026
You will receive q operations: ADD x or FIRST. ADD adds number x to stream. FIRST should output the first number that has appeared exactly once so far, or -1 if none....

Keys by Value Range

Hard
3 views 24 Jan 2026
Read n pairs key value. Then two integers L and R. Output how many keys have value in range [L,R]....

Frequency of Frequencies

Hard
3 views 24 Jan 2026
Read n words. Build frequency of each word. Then q queries of integer f. For each query, output how many distinct words have frequency exactly f....

Swap Values of Two Keys

Easy
3 views 24 Jan 2026
Read n key-value pairs (string keys and string values). Then two keys k1 and k2 are provided. If both keys exist, swap their values. Finally output value of k1 and value of k2 (use NA if a key does no...

Max Value Per Key

Medium
2 views 24 Jan 2026
Read n pairs key and integer value. If a key comes many times, keep only the maximum value for that key. After processing, output each key with its max value, sorted by key....

Count Subarrays XOR K

Hard
4 views 24 Jan 2026
Read n integers and target K. Count number of subarrays with bitwise XOR exactly K. Output the count....

Basic Calculator

Easy
3 views 24 Jan 2026
Input has two integers a and b and an operator op are provided (+, -, *, /, %). For / do integer floor division like Python //. Output the result....

Quotient and Remainder

Easy
2 views 24 Jan 2026
Input has two integers a and b are provided (b != 0). Output quotient (a//b) and remainder (a%b) in one line....

Even Odd Using Mod

Easy
4 views 24 Jan 2026
Read one integer n. Output EVEN if n is even else ODD....

Compare Two Numbers

Easy
3 views 24 Jan 2026
Read two integers a and b. Output < if a if a>b else =....

In Range Check

Easy
3 views 24 Jan 2026
Read three integers x L R. Output YES if L...

Minimum of Three

Easy
4 views 24 Jan 2026
Read three integers a b c. Output the minimum using operators and comparisons....

Bitwise AND

Easy
3 views 24 Jan 2026
Read two non-negative integers a and b. Output a & b....

Bitwise OR

Easy
2 views 24 Jan 2026
Read two non-negative integers a and b. Output a | b....

Bitwise XOR

Easy
2 views 24 Jan 2026
Read two non-negative integers a and b. Output a ^ b....

Toggle Kth Bit

Easy
3 views 24 Jan 2026
Read two integers n and k. Toggle (flip) the k-th bit (0-based) of n and output the new number....

Expression Value A

Medium
3 views 24 Jan 2026
Four integers a b c d are provided. Compute (a+b)*c - d and output it....

Expression Value B

Medium
2 views 24 Jan 2026
Read three integers a b c. Compute a + b*c and a*b + c. Output both in one line....

Power Mod

Medium
2 views 24 Jan 2026
Integers a b m are provided. Output (a^b) % m. Use fast power (pow with mod)....

Kth Bit Check

Medium
3 views 24 Jan 2026
Read two non-negative integers n and k. Output 1 if k-th bit (0-based) of n is set, else 0....

Count Set Bits

Medium
3 views 24 Jan 2026
One non-negative integer n is provided. Count how many 1 bits are in binary representation and output it....

Remove Rightmost Set Bit

Medium
7 views 24 Jan 2026
One non-negative integer n is provided (n>0). Remove the rightmost set bit once and output the new number....

Opposite Signs

Medium
4 views 24 Jan 2026
Read two integers a and b. Output YES if they have opposite signs (one negative, one positive). If any is zero, output NO....

Missing Number XOR

Medium
3 views 24 Jan 2026
Read n-1 numbers from 1..n (one is missing). Compute the missing number using XOR....

Hamming Distance

Medium
2 views 24 Jan 2026
Read two non-negative integers a and b. Hamming distance is number of different bits. Output it....

Multiply By Power of Two

Medium
3 views 24 Jan 2026
Read two integers x and k. Output x * (2^k) using shift operator....

Divide By Power of Two

Medium
3 views 24 Jan 2026
Input has two integers x and k are provided (k>=0). Output floor(x / (2^k)) using right shift (for non-negative x)....

32-bit Left Rotate

Medium
3 views 24 Jan 2026
Read two integers x and r. Treat x as unsigned 32-bit. Rotate left by r and output the unsigned result....

Add Without Plus

Hard
3 views 24 Jan 2026
Read two integers a and b. Add them without using + or -. Use bit operations and output sum....

Make Number Even

Medium
2 views 24 Jan 2026
Read one integer n. In one move you can add 1 or subtract 1. Output minimum moves needed to make n even....

Reduce Fraction

Medium
2 views 24 Jan 2026
Input has two integers p and q are provided (q != 0). Reduce the fraction p/q and output as p q (reduced). Keep denominator positive....

Bitmask From Indices

Medium
4 views 24 Jan 2026
Read n and then k indices (0-based). Build a bitmask with those bits set and output it as integer....

Next Number Same Bitcount

Hard
3 views 24 Jan 2026
One non-negative integer n is provided (n>0). Compute the smallest integer > n that has the same number of set bits. Output it....

Min Flips To Match OR

Hard
3 views 24 Jan 2026
Read three non-negative integers a b c. In one flip you can change one bit of a or b. Compute minimum flips needed so that (a | b) == c....

Total Hamming Distance

Hard
3 views 24 Jan 2026
Read n integers, total Hamming distance is sum of distances over all pairs (i...

Maximum XOR Pair

Hard
5 views 24 Jan 2026
Read n integers, find maximum value of ai ^ aj over all pairs. Output the maximum XOR....

Huge Power Mod (Exponent as String)

Hard
3 views 24 Jan 2026
Integers a and m are provided, and exponent b is provided as a very large decimal string. Output (a^b) % m....

Bitwise Subset XOR Sum

Hard
3 views 24 Jan 2026
Read n numbers, consider all subsets. For each subset take XOR of its elements. Output the sum of XOR over all subsets....

Range XOR Queries

Hard
3 views 24 Jan 2026
Read array of n integers and q queries (l r). For each query output XOR of a[l..r] (1-based)....

Bitwise AND Over Range

Hard
3 views 24 Jan 2026
Read n integers and q queries (l r). For each query output bitwise AND of a[l..r] (1-based)....

Boolean XOR Expression

Hard
3 views 24 Jan 2026
A boolean string s of 0/1 and a boolean string t of 0/1 are provided, same length. Treat them as bits and compute (s XOR t) as a new string. Output it....

String Length Info

Easy
4 views 24 Jan 2026
Input is a single string s is provided (can contain spaces). Output its length, first character and last character. If string is empty, output 0 - -....

Reverse String

Easy
3 views 24 Jan 2026
Input is a single string s is provided (no trailing spaces needed). Output the reversed string....

Count Vowels

Easy
2 views 24 Jan 2026
A string s is provided. Count how many vowels (a,e,i,o,u) are present (both cases). Output the count....

Toggle Case

Easy
3 views 24 Jan 2026
A string s is provided. Convert lowercase to uppercase and uppercase to lowercase. Other characters keep same. Output final string....

Remove Spaces

Easy
3 views 24 Jan 2026
A string s is provided. Remove all space characters and output the new string....

Palindrome Check

Easy
3 views 24 Jan 2026
A string s (only letters and digits) is provided. Output YES if it is palindrome else NO....

Count Character

Easy
3 views 24 Jan 2026
A string s is provided and a character ch is provided. Count how many times ch occurs in s....

Replace Character

Easy
2 views 24 Jan 2026
A string s is provided, and two characters a and b. Replace every a with b and output result....

Join Words with Dash

Easy
2 views 24 Jan 2026
A sentence line is provided with words separated by spaces. Join words using '-' and output....

Prefix Check

Easy
2 views 24 Jan 2026
Read two strings s and p. Output YES if s starts with p else NO....

Run Length Encode

Medium
3 views 24 Jan 2026
A string s is provided. Compress it using run-length encoding as: char followed by count (only when count>1). Output encoded string....

Run Length Decode

Medium
2 views 24 Jan 2026
An encoded string is provided like a3b2c (letters with optional number). Decode and output the original string....

Longest Word

Medium
2 views 24 Jan 2026
A sentence is provided. Words are separated by spaces. Output the longest word. If tie, output the first one....

Remove Consecutive Duplicates

Medium
3 views 24 Jan 2026
A string s is provided (no spaces). Remove consecutive duplicate characters and output result....

First Unique Character

Medium
3 views 24 Jan 2026
A string s is provided (no spaces). Output the first character that appears exactly once. If none, output -1....

Anagram Check

Medium
4 views 24 Jan 2026
Input has two strings a and b are provided (lowercase letters). Output YES if they are anagrams else NO....

Rotate String by K

Medium
3 views 24 Jan 2026
A string s and integer k are provided. Rotate string to the right by k positions and output....

Check Balanced Parentheses

Medium
4 views 24 Jan 2026
A string s is provided containing only '(' and ')'. Output YES if it is balanced else NO....

All Indices of Substring

Medium
2 views 24 Jan 2026
Read two strings s and p. Output all starting indices (0-based) where p occurs in s. If none, output -1....

String to Integer Parser

Medium
2 views 24 Jan 2026
A string s is provided (maybe with leading spaces and sign). Parse first integer like simple atoi. If no number, output 0....

Longest Common Prefix

Medium
2 views 24 Jan 2026
Read n strings. Output their longest common prefix. If no common prefix, output EMPTY....

Remove All Digits

Medium
2 views 24 Jan 2026
A string s is provided. Remove all digits (0-9) and output remaining string....

Smallest Character Window

Medium
3 views 24 Jan 2026
A string s is provided and integer k. Output the lexicographically smallest substring of length k. If k>len(s), output EMPTY....

Reverse Words

Medium
2 views 24 Jan 2026
A sentence is provided. Reverse order of words and output. Extra spaces should be treated as separators....

KMP Pattern Count

Hard
3 views 24 Jan 2026
Read two strings text and pattern. Count how many times pattern occurs in text (overlapping allowed). Output the count....

Longest Palindromic Substring Length

Hard
2 views 24 Jan 2026
A string s is provided (no spaces). Compute length of longest palindromic substring. Use linear-time method....

Decode Nested Repeat

Hard
4 views 24 Jan 2026
A string is provided in form like 3[a2[c]] where number means repeat. Decode and output the final string....

Remove Pattern Repeatedly

Hard
2 views 24 Jan 2026
Read two strings s and p. Remove every occurrence of p from s while scanning left to right (like stack remove). Output final string....

Smallest Rotation

Hard
3 views 24 Jan 2026
A string s is provided. Consider all rotations of s. Output the lexicographically smallest rotation....

Wildcard Match

Hard
2 views 24 Jan 2026
Read string s and pattern p with '?' (any char) and '*' (any sequence). Output YES if pattern matches whole string else NO....

Minimum Insertions Palindrome

Hard
3 views 24 Jan 2026
A string s is provided (no spaces). Compute minimum insertions needed to make it a palindrome. Output the number....

Smallest Subsequence of Length K

Hard
3 views 24 Jan 2026
A string s and integer k are provided. Pick a subsequence of length k (keep order) with smallest lexicographic value. Output that subsequence....

Big Integer Addition

Hard
3 views 24 Jan 2026
Two non-negative integers a and b are provided as strings (very large). Output a+b....

Isomorphic Strings

Medium
3 views 24 Jan 2026
Input has two strings s and t are provided (same length). Two strings are isomorphic if each character in s can be mapped to exactly one character in t and vice-versa. Output YES or NO....

Z Pattern Count

Hard
3 views 24 Jan 2026
Read two strings text and pattern. Count how many times pattern occurs in text (overlapping allowed). Use Z algorithm logic and output count....

Add Using Function

Easy
2 views 24 Jan 2026
Read two integers a and b. Write a function add(a,b) and output add(a,b)....

Max of Two

Easy
2 views 24 Jan 2026
Read two integers a and b. Write a function mx(a,b) that returns bigger value (if equal return same). Output result....

Absolute Value

Easy
2 views 24 Jan 2026
Read one integer n. Create function ab(n) and output absolute value....

Area of Circle

Easy
2 views 24 Jan 2026
Radius r is provided. Make function area(r)=pi*r*r and output with 2 decimals. Use pi=3.141592653589793....

Count Digits Function

Easy
2 views 24 Jan 2026
One non-negative integer n is provided. Make function digits(n) and output digit count (for n=0 count is 1)....

Factorial Function

Easy
2 views 24 Jan 2026
Read one integer n. Make function fact(n) and output n!...

Fibonacci Function

Easy
3 views 24 Jan 2026
Read one integer n. Make function fib(n) that returns nth Fibonacci (0-index: fib(0)=0,fib(1)=1). Output fib(n)....

GCD Function

Easy
4 views 24 Jan 2026
Read two integers a and b. Write function gcd(a,b) using Euclid and output it (always non-negative)....

Prime Check Function

Easy
2 views 24 Jan 2026
Read one integer n. Write function is_prime(n) and output YES if prime else NO....

Count Vowels Function

Easy
2 views 24 Jan 2026
One line string s is provided. Write function vowel_count(s) and output number of vowels....

Sum of Squares List

Medium
2 views 24 Jan 2026
Read n and n integers. Write function sum_sq(arr) to return sum of squares and output it....

Normalize Names

Medium
2 views 24 Jan 2026
Read n names (one per line). Make function norm(name) which trims spaces and converts to Title Case (first letter uppercase, rest lowercase per word). Output normalized names....

Apply Operation

Medium
7 views 24 Jan 2026
Read a b and op (ADD/SUB/MUL). Create function apply(a,b,op) and output result....

Multi Query Fibonacci

Medium
2 views 24 Jan 2026
Read q queries, each query is n. Make a fib function and answer all queries fast using memoization....

Return Min Max

Medium
3 views 24 Jan 2026
Read n integers, write function minmax(arr) returning (min,max). Output min and max....

LCM Using GCD

Medium
2 views 24 Jan 2026
Read two integers a and b. Write gcd and lcm functions. Output lcm(a,b). If any is 0, lcm is 0....

Reverse Words Function

Medium
3 views 24 Jan 2026
One line sentence is provided. Write function rev_words(s) that reverses word order. Output output....

Count Substring Occurrences

Medium
4 views 24 Jan 2026
Read two strings s and p. Write function count_occ(s,p) and output number of occurrences (overlap allowed)....

Sum of Digits Recursive

Medium
2 views 24 Jan 2026
Input has one integer n is provided (non-negative). Write recursive function sumdig(n). Output result....

Power Recursive

Medium
2 views 24 Jan 2026
Read integers a and b (b>=0), write recursive function powr(a,b) and output a^b....

Filter Even Numbers

Medium
2 views 24 Jan 2026
Read n integers. Write function only_even(arr) that returns list of even numbers in same order. Output them space-separated, if none output EMPTY....

Split Into Chunks

Medium
2 views 24 Jan 2026
Read n integers and chunk size k. Write function chunks(arr,k) that prints each chunk sum in new line....

Prefix Sum Function

Medium
3 views 24 Jan 2026
Read n integers and q queries (l r, 1-based). Write function build_prefix(arr) and answer sums fast....

Function Call Counter

Medium
2 views 24 Jan 2026
Read n. Define function step(x) that returns x//2 if x even else 3*x+1. Starting from n, keep applying step until 1. Output number of steps....

Binary Search Function

Medium
2 views 24 Jan 2026
Read sorted array of n integers and target x, write function bsearch(arr,x) returning index (0-based) or -1. Output result....

Count Paths Grid

Hard
2 views 24 Jan 2026
Read m n. Write function ways(m,n) that returns number of paths from (0,0) to (m-1,n-1) moving only right or down....