4 views
24 Jan 2026
Input provides {x}. Implement bfs to output shortest distance (edges count) or -1....
4 views
24 Jan 2026
Input provides {x}. Create Graph class with bfs(s,t) method. Output shortest distance or -1....
4 views
24 Jan 2026
You get {x}. 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. ...
4 views
24 Jan 2026
We have {x}. Create Trie class. For COUNT output how many added words have this prefix....
5 views
24 Jan 2026
For each testcase you get weighted undirected graph. Output shortest distance from 1 to n. If unreachable output -1....
4 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)....
4 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....
4 views
24 Jan 2026
We have {x}. If never repeats, output -1....
4 views
24 Jan 2026
Input provides {x}. Write function merge(intervals) and output merged intervals sorted....
5 views
24 Jan 2026
Given {x}, Two types: 1 i x means set a[i]=x, 2 l r means output sum of a[l..r] (1-based). Implement build/update/query helpers....
4 views
24 Jan 2026
You're given {x}. For each window output maximum. Use a deque....
4 views
24 Jan 2026
You get {x}. Compute the minimum length of a contiguous subarray with sum >= S. If not found, output 0....
5 views
24 Jan 2026
For each testcase you get a tree with n nodes. Output the diameter length (number of edges on longest path)....
4 views
24 Jan 2026
Consider {x}. Output result....
4 views
24 Jan 2026
Given {x}, Output their longest common prefix. If no common prefix, output EMPTY....
4 views
24 Jan 2026
For each testcase you get n numbers. Compute length of the longest prefix that is strictly increasing....
5 views
24 Jan 2026
For each testcase you get n, k and n numbers. Output max of each window of size k (space-separated)....
5 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....
17 views
24 Jan 2026
Consider {x}. Use recursion function dfs(i,cur) to generate all subset sums. Output sums sorted....
4 views
24 Jan 2026
We have {x}....
4 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....
5 views
24 Jan 2026
Input provides {x}. Compute length of the longest contiguous subarray that has at most K distinct numbers....
6 views
24 Jan 2026
You're given {x}. Compute maximum subarray sum in circular array and output it....
4 views
24 Jan 2026
Given {x}, Output prefix sum after each element (same order)....
5 views
24 Jan 2026
Consider {x}. Build SegmentTree class with update(i,x) and query(l,r) returning minimum. Output query answers....
4 views
24 Jan 2026
Input provides {x}. Implement to build prefix hashes and answer hash values mod 1000000007....
4 views
24 Jan 2026
We have {x}. 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....
4 views
24 Jan 2026
For each testcase you get a directed graph. If topological order exists, output one order. If cycle exists, output CYCLE....
4 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)....
4 views
24 Jan 2026
One non-negative integer n is provided. Count how many 1 bits are in binary representation and output it....
4 views
24 Jan 2026
You get {x}. Output its binary without using bin(). Use repeated division and variables....
4 views
24 Jan 2026
You're given {x}. Output 1 if k-th bit (0-based) of n is set, else 0....
5 views
24 Jan 2026
For each testcase you get n, k and n integers. Output the k-th largest element....
5 views
24 Jan 2026
You're given {x}. Compute kth smallest element using quickselect style and output it....
4 views
24 Jan 2026
Consider {x}. For each word, count all its prefixes. Then q prefixes are provided. For each prefix output how many words start with it....
4 views
24 Jan 2026
Consider {x}. Write function build_prefix(arr) and answer sums fast....
4 views
24 Jan 2026
We have {x}. Sort them by frequency ascending, if tie by value ascending. Output sorted list....
4 views
24 Jan 2026
Consider {x}. Create Circle class with area() and sort circles by area ascending. Output sorted radii....
4 views
24 Jan 2026
Consider {x}. Output YES if there exists a subarray with sum exactly S else NO....
4 views
24 Jan 2026
Consider {x}. Add them without using + or -. Use bit operations and output sum....