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....
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....
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....
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....
2 views
24 Jan 2026
Read n keys (one per line). Then query key is provided. Output YES if query exists else NO....
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....
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....
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....
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....
2 views
24 Jan 2026
Read n words (one per line). Output each distinct word with its count, sorted by word....
3 views
24 Jan 2026
Read n words and integer k. Output top k words by frequency (desc), tie by word (asc)....
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....
2 views
24 Jan 2026
Read n words in order. Output the first word that appears exactly once. If none, output NONE....
3 views
24 Jan 2026
Read n keys with integer values. Count how many unordered pairs of keys have same value. Output the number....
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....
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....
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....
2 views
24 Jan 2026
Read two dictionaries A and B as lists of keys. Output how many keys are present in both....
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....
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....
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....
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....
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....
3 views
24 Jan 2026
Read n integers and target K. Count number of subarrays with sum exactly K. Output the count....
3 views
24 Jan 2026
Read n integers and K. Compute length of the longest contiguous subarray that has at most K distinct numbers....
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....
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....
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....
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....
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....
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]....
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....
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...
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....
4 views
24 Jan 2026
Read n integers and target K. Count number of subarrays with bitwise XOR exactly K. Output the count....