5 views
24 Jan 2026
You are given two values a and b. Swap them and print the swapped values. Use JavaScript style swap (no third variable)....
4 views
24 Jan 2026
Given one value as a string input, print its real JavaScript type in a friendly way: null, array, object, number, string, boolean, undefined, function....
2 views
24 Jan 2026
Given an integer n, print YES if it is a power of 2, else print NO. Use bit logic, not loops....
2 views
24 Jan 2026
Given two integers L and R, print FizzBuzz style output for all numbers from L to R (inclusive). For multiples of 3 print Fizz, multiples of 5 print Buzz, multiples of both print FizzBuzz, else print ...
4 views
24 Jan 2026
Given a string, count how many vowels are there (a,e,i,o,u) ignoring case. Print the count....
4 views
24 Jan 2026
Given an array of integers, print the sum of only even numbers....
4 views
24 Jan 2026
Given an array, find the first value that appears again when scanning from left to right. If no duplicate, print -1....
4 views
24 Jan 2026
Given a JSON object, count how many own properties have a value that is NOT a function. Print the count....
4 views
24 Jan 2026
Input has two lines: first is a JSON string, second is a default value as JSON. If first line parses, print parsed JSON (stringified). If it fails, print the default JSON as output....
3 views
24 Jan 2026
You have a button with id btn and a box with id box. When user clicks button, toggle class active on #box. Write the JavaScript code....
5 views
24 Jan 2026
Given an array and a number k, rotate the array to the left by k steps and print the result....
5 views
24 Jan 2026
You have meeting time intervals [start,end]. Merge all overlapping intervals and print the merged list sorted by start....
3 views
24 Jan 2026
Given a list of students with name and city, group them by city and print each city with names in input order....
4 views
24 Jan 2026
Input has a list of queries for a slow function f(x)=x*x+1. For repeated x, do not recompute; use memoization and print outputs for each query....
3 views
24 Jan 2026
You are given variable declarations line by line in a tiny language: 'let x', 'block', 'end'. Count how many times a 'let x' shadows an existing x in an outer scope....
2 views
24 Jan 2026
Given an expression with + - * / and non-negative integers, compute the result using correct precedence (* and / first). Integer division should floor....
3 views
24 Jan 2026
Given a string with brackets (), {}, [], check if it is balanced. Print YES or NO....
4 views
24 Jan 2026
Input is a JSON array with mixed values. Convert each item to a number using Number(). Print a JSON array where invalid conversions become null....
4 views
24 Jan 2026
You are given two integers: attempts and failCount. Simulate a task that fails first failCount times and then succeeds. Using async/await, retry until success or attempts finish. Print SUCCESS or FAIL...
3 views
24 Jan 2026
Given a number x. If x is negative, throw an error 'NEG'. Catch it and print 'Bad input: NEG'. Otherwise print x*x....
3 views
24 Jan 2026
Implement a queue with methods enqueue, dequeue, size. Process commands: ENQ x, DEQ, SIZE. Print outputs of DEQ and SIZE....
4 views
24 Jan 2026
You are given an array of objects like {name,score}. Create table rows inside . For each item, add namescore....
2 views
24 Jan 2026
Given a JSON object, freeze it and also freeze all direct child objects/arrays (one level deep). Print DONE....
6 views
24 Jan 2026
Create a function add(a)(b)(c) that returns a+b+c. For input a b c, print the result using currying....
4 views
24 Jan 2026
Given n tasks durations (ms) and a limit k, simulate running tasks with max k parallel workers. Print total time taken....
5 views
24 Jan 2026
Given n numbers and window size k, print the maximum for each window....
4 views
24 Jan 2026
Given an array and integer k, find the k-th smallest element (1-based) without fully sorting....
5 views
24 Jan 2026
You are given a grid with 0 (free) and 1 (blocked). You can move only right or down. Count number of ways from top-left to bottom-right modulo 1000000007....
4 views
24 Jan 2026
Two very large non-negative integers are given as strings. Add them and print the sum as string....
3 views
24 Jan 2026
Input has lines like KEY=VALUE. Ignore empty lines and lines starting with #. Print JSON object of key-value pairs (as strings)....
4 views
24 Jan 2026
Implement LRU cache of capacity C. Commands: GET key, PUT key value. GET prints value or -1. PUT updates cache....
4 views
24 Jan 2026
You are given n numbers. For each number x, apply async steps: add 1, then multiply by 2, then subtract 3 (each step is awaited). Print final numbers....
5 views
24 Jan 2026
Given duration t and timeout ms. Simulate a promise that resolves after t ms. If it does not finish within timeout, print TIMEOUT else DONE....
4 views
24 Jan 2026
Given n and n integers. For each integer x, create a promise that rejects if x is odd, resolves if x is even. Wait all and print count of rejects....
5 views
24 Jan 2026
Process commands on an emitter: ON event, ONCE event, EMIT event, OFF event. Maintain how many times handler runs and print total at end....
5 views
24 Jan 2026
You got n numbers in an array. Print them in reverse order. Simple thing, but do it clean....
4 views
24 Jan 2026
Given an array and a value x, find the first index (0-based) where x is present. If not present, print -1....
4 views
24 Jan 2026
Array diya hai. Check karo whether it is non-decreasing (every next element is >= previous). Print YES or NO....
6 views
24 Jan 2026
Given an array, move all zeros to the end, but keep the order of non-zero items same. Print the updated array....
4 views
24 Jan 2026
Array diya hai. Print (maximum - minimum)....
6 views
24 Jan 2026
Given array and number x, count how many times x appears....
4 views
24 Jan 2026
Find the second largest distinct value in the array. If it does not exist, print -1....
5 views
24 Jan 2026
Given an array, print its running sum array. Running sum at i is sum of elements from 0 to i....
4 views
24 Jan 2026
Array se value x ko jitni baar bhi aayi hai, sab hata do. Baaki order same rehna chahiye. Print new length and new array....
3 views
24 Jan 2026
Given n, k and an array. Count how many subarrays have sum exactly k....
6 views
24 Jan 2026
Find the maximum possible sum of a contiguous subarray. Print the maximum sum....
4 views
24 Jan 2026
For each index i, print product of all elements except arr[i]. Do it without using division....
5 views
24 Jan 2026
Array has n-1 numbers from 1..n, one number is missing. Find and print it....
5 views
24 Jan 2026
Given array and value k, you want all elements ...
5 views
24 Jan 2026
Find an index i such that sum of left side equals sum of right side. Print smallest such index, else -1....
4 views
24 Jan 2026
Given an array, print the k most frequent numbers. If frequency ties, smaller number comes first....
4 views
24 Jan 2026
Given an array, find the longest contiguous subarray that contains at most 2 distinct numbers. Print its length....
4 views
24 Jan 2026
Rotate array to the right by k steps, in-place idea using gcd cycles. Print rotated array....
6 views
24 Jan 2026
For each element, find the next greater element on its right side. If none, print -1 at that position....
4 views
24 Jan 2026
Array me sirf 0,1,2 hain. Sort it in O(n) time and O(1) extra space....
5 views
24 Jan 2026
Count subarrays whose sum is divisible by k....
6 views
24 Jan 2026
Given r x c matrix, print all elements in spiral order....
6 views
24 Jan 2026
Count number of inversions in the array (iarr[j]). Print the count....
5 views
24 Jan 2026
Given heights array, find how much water can be trapped after rain....
4 views
24 Jan 2026
Given bar heights, find the largest rectangle area in histogram....
6 views
24 Jan 2026
Each element tells max jump length. Find minimum jumps needed to reach last index. If not possible, print -1....
5 views
24 Jan 2026
For every window size from 1 to n, print the maximum among all minimums of windows of that size....
5 views
24 Jan 2026
Given array and m, split into m continuous parts so that the largest part sum is minimum. Print that minimum largest sum....
5 views
24 Jan 2026
Find length of the Longest Increasing Subsequence (not necessarily contiguous)....
3 views
24 Jan 2026
Given array (can have negatives) and value K, find the length of shortest subarray with sum >= K. If not found, print -1....
5 views
24 Jan 2026
Numbers are all positive. Find the minimum length of a contiguous subarray with sum >= S. If not possible, print 0....
4 views
24 Jan 2026
You may delete at most one element from the array (or delete none). Find the maximum subarray sum possible after that....
4 views
24 Jan 2026
Given a number x, return 2*x using async/await style. Print the result....
3 views
24 Jan 2026
Input has one line text. Print the same text, but do it inside an async function with one await....
6 views
24 Jan 2026
Given two numbers a and b, find the bigger number using async/await and print it....
3 views
24 Jan 2026
Given three integers a b c, return their sum using async function add(). Print sum....
3 views
24 Jan 2026
Given an integer n, write async function that returns EVEN or ODD. Print it....
2 views
24 Jan 2026
Given a and b, do a/b using async function. If b is 0, catch error and print DIV0....
4 views
24 Jan 2026
Input is a JSON value. If it is a number, print it. Otherwise print INVALID. Do parsing inside async/await....
2 views
24 Jan 2026
Given a sentence, reverse word order using an async function and print it....
7 views
24 Jan 2026
Given an integer n, count digits (ignore sign) using async function and print count....
3 views
24 Jan 2026
Given n numbers, square each number using async function in parallel (Promise.all). Print sum of squares....
3 views
24 Jan 2026
Given n numbers, apply async transform f(x)=x*3+1 one by one (series). Print results....
4 views
24 Jan 2026
Given n numbers, apply async transform f(x)=x*x-1 in parallel, but output must be in original order....
3 views
24 Jan 2026
Given n integers. Create promise for each: resolve if x is even, reject if x is odd. Use allSettled and print okCount failCount....
4 views
24 Jan 2026
Given n integers, sum them using async reduce pattern (await inside loop). Print sum....
3 views
24 Jan 2026
You have n task durations. If done sequentially, total is sum. If done in parallel with unlimited workers, total is max. Print both totals....
4 views
24 Jan 2026
You get attempts and a list of values returned by a flaky API (length attempts). The first non-zero value means success. Print the value, or FAIL....
2 views
24 Jan 2026
Input has n numbers. Apply steps on each number: +1 then *2 then -3. Use async/await and print final numbers....
4 views
24 Jan 2026
Given n numbers and limit k, apply async function f(x)=x*x with at most k in flight. Output results in original order....
3 views
24 Jan 2026
Given n numbers and limit k. Task rejects if number is negative, else resolves with abs value. Run with max k concurrency and print okCount failCount....
3 views
24 Jan 2026
Given totalSteps N and cancelAt (1-based). Run an async loop from 1..N. If i reaches cancelAt, stop and print CANCELLED i. If cancelAt is 0, complete and print DONE N....
5 views
24 Jan 2026
You have n tasks, each has priority and value. You always pick highest priority next (bigger is higher). Process in that order and print the final values (value*2)....
2 views
24 Jan 2026
Given n numbers and batch size b. Process each batch in parallel, but inside a batch do series (await each). Output total batches and the final sum....
3 views
24 Jan 2026
Given n values. For each value x, async task succeeds if x%3==0 and returns x. Run all tasks in parallel and print the smallest successful value, else print NONE....
4 views
24 Jan 2026
You have tasks 1..n with durations. Also m dependencies (u v) meaning u must finish before v starts. Compute total minimum time to finish all tasks (no worker limit)....
5 views
24 Jan 2026
Given an integer n, print its absolute value using async/await style....
3 views
24 Jan 2026
Given n numbers, a task succeeds if number is divisible by 5. Run tasks and print the first successful number in input order. If none, print ALL_FAIL....
3 views
24 Jan 2026
Given n integers, keep only positive numbers using async predicate. Print new length and the filtered list....
2 views
24 Jan 2026
You have q keys. API for key k returns k*k. Use caching so each distinct key calls API only once. Print apiCalls, then outputs for each query....
4 views
24 Jan 2026
You have capacity C and a list of events: ACQ or REL. ACQ means one async job started, REL means one finished. If at any time active goes above C or REL happens at active=0, print INVALID else VALID....
5 views
24 Jan 2026
Given n numbers and chunk size c. For each chunk, sum numbers in parallel (Promise.all) and add to total. Print final total sum....
4 views
24 Jan 2026
You have n task durations and limit k. Start first k tasks. When one finishes, start next. Print total time in first line, and completion order of task indices (1-based) in second line....
2 views
24 Jan 2026
Given n numbers and limit k. Task succeeds if x is prime (returns x), else rejects. Run with max k in-flight and print the first fulfilled value in input order; if none, print NONE....
3 views
24 Jan 2026
Marks diye hain (0 to 100). Print grade as per rule: 90+ A, 80-89 B, 70-79 C, 60-69 D, else F....
3 views
24 Jan 2026
Input is day number (1-7). Print day name (Monday..Sunday). If number is out of range, print INVALID....
3 views
24 Jan 2026
Given n, print n! (factorial). Use loop and BigInt because number can be big....
4 views
24 Jan 2026
Input has integers separated by spaces/new lines. Keep adding until you see 0. Print the sum (0 is not included)....
3 views
24 Jan 2026
Given n numbers, count how many are odd and how many are even. Print as: oddCount evenCount....
2 views
24 Jan 2026
Given n, print staircase pattern of numbers. Line i has numbers from 1 to i (space separated)....
3 views
24 Jan 2026
Year diya hai. Print YES if leap year else NO. Leap year rules apply (div by 400 or div by 4 but not by 100)....
3 views
24 Jan 2026
Given N, find the smallest multiple of 7 which is >= N. Print that number....
4 views
24 Jan 2026
Given an integer n, find the product of its digits (ignore sign). Print the product....
2 views
24 Jan 2026
Given n, apply Collatz until it becomes 1. If n is even: n=n/2 else n=3n+1. Print number of steps. If steps cross 1000000, print -1....
3 views
24 Jan 2026
Two players played Rock-Paper-Scissors for n rounds. You get two strings A and B (length n) with chars R/P/S. Print A if player A wins, B if player B wins, else DRAW....
5 views
24 Jan 2026
Given amount, break it into notes of 2000,500,200,100,50,20,10 using greedy. Print counts in same order. If amount is not multiple of 10 or negative, print -1....
5 views
24 Jan 2026
Given a password string, print STRONG if it has at least 8 chars and contains at least one lowercase, uppercase, digit, and one special from !@#$%^&*. Otherwise print WEAK....
4 views
24 Jan 2026
Given a lowercase string, find the first character that does not repeat. Print the character, or -1 if all repeat....
6 views
24 Jan 2026
Given a string, compress it using run-length encoding: aaaabb -> a4b2. Print encoded string....
4 views
24 Jan 2026
Input is time in 12-hour format like HH:MM AM/PM. Convert to 24-hour format HH:MM and print....
2 views
24 Jan 2026
Given n (0-based), print n-th row of Pascal triangle (space separated)....
3 views
24 Jan 2026
Given L and R, count how many prime numbers are there in [L,R]....
4 views
24 Jan 2026
You get a string of commands with letters L,R,U,D. Start at (0,0). Print final x y....
3 views
24 Jan 2026
You get command string L,R,U,D. Find the earliest step (1-based) when position becomes (0,0) again. If never, print -1....
6 views
24 Jan 2026
Given a postfix expression with space-separated tokens (numbers and + - * /). Evaluate it and print result. Division is integer division toward zero....
3 views
24 Jan 2026
Given n, in one step you can do: if even n=n/2 else n=n-1. Count steps to reach 1. Print steps....
4 views
24 Jan 2026
Given a string with only '(' and ')', find length of the longest valid (well-formed) parentheses substring....
4 views
24 Jan 2026
Input like 3[a2[c]] means repeat inside brackets. Decode and print final string....
3 views
24 Jan 2026
You can do operations: n=n-1, if n%2==0 n=n/2, if n%3==0 n=n/3. Find minimum steps to make n to 1....
4 views
24 Jan 2026
You get a grid with 0 (free) and 1 (blocked). Find shortest steps from (0,0) to (r-1,c-1) moving 4 directions. Print -1 if not possible....
3 views
24 Jan 2026
You have n steps. You can climb 1 or 2 steps. Some steps are broken (cannot land). Count number of ways to reach step n mod 1000000007....
4 views
24 Jan 2026
You start with balance 0. Commands: COIN x (add to balance) and BUY p (try to buy item price p). If balance>=p print OK and reduce balance, else print NEED. At end print final balance....
3 views
24 Jan 2026
Given 9x9 grid (0 means empty), check if rows and columns are valid (no duplicate 1..9). Print YES or NO....
3 views
24 Jan 2026
n people are standing in a circle (1..n). Starting from 1, every k-th person is removed. Print the winner position....
3 views
24 Jan 2026
You get m instructions. Each instruction is: INC x, DEC x, JNZ x off. x is variable name (single word). Start all vars at 0. Execute from line 1. JNZ jumps relative if x!=0. Stop when pointer goes out...
3 views
24 Jan 2026
A traffic light has 3 phases: Red, Yellow, Green with fixed durations. You are given current phase (R/Y/G) and how many seconds are left in that phase. Find how many seconds you will wait to see Green...
2 views
24 Jan 2026
You get a JSON array. Count how many values are truthy in JavaScript (like 1, "hi", [], {} are truthy; 0, "", null, false are falsy). Print the count....
5 views
24 Jan 2026
Two JSON values are given on two lines: a and b. Print the value of (a ?? b) as JSON (stringified). Remember: only null and undefined trigger the fallback, not 0 or empty string....
2 views
24 Jan 2026
One string is given. If JavaScript Number(s) becomes a valid number (not NaN), print YES else print NO....
8 views
24 Jan 2026
One number is given as string (can be -0). Print YES if it is exactly -0 in JavaScript, else NO....
4 views
24 Jan 2026
One number string is given. Print YES if it is a finite number in JavaScript (not NaN, not Infinity), else NO....
5 views
24 Jan 2026
You get a JSON array with mixed values. Count how many are: number, string, boolean, null, array, object. Print 6 counts in this order....
5 views
24 Jan 2026
Two JSON values are given on two lines: a and b. Print two words: the result of (a == b) and (a === b) as YES/NO....
2 views
24 Jan 2026
One JSON value is given. Print two values: String(v) and JSON.stringify(v). If JSON.stringify gives undefined, print the word UNDEFINED there....
6 views
24 Jan 2026
Two JSON values are given on two lines. Print YES if both values have the same JavaScript type (treat null as its own type and array as its own type). Else print NO....
3 views
24 Jan 2026
You get one JSON value (can be nested). Traverse all nested values and count how many times each type appears: number, string, boolean, null, array, object. Print counts as JSON object....
5 views
24 Jan 2026
Given a JSON object, print the same object but with keys sorted alphabetically at every level (recursive). Output should be JSON string....
4 views
24 Jan 2026
Two integers are given as strings. If both fit safely in JavaScript Number and the sum is also safe, print the sum as Number. Otherwise print the sum using BigInt....
7 views
24 Jan 2026
You get a JSON array. Convert every item with Number(x). Ignore items that become NaN. Sum remaining values and print the sum....
3 views
24 Jan 2026
You get q queries. Each query has two number strings a and b. For each, print SAME if Object.is(a,b) is true, else DIFF. Handles NaN and -0 properly....
4 views
24 Jan 2026
You get a JSON array. Convert each item to a display string: primitives use String(x), null becomes 'null', objects/arrays become JSON string. Print JSON array of these strings....
4 views
24 Jan 2026
One line has space-separated tokens. For each token, print YES if it is a valid base-10 integer format: optional leading '-' and digits, and no leading zeros unless the number is exactly 0. Else print...
5 views
24 Jan 2026
Given three number strings x min max. If x is NaN print NaN. Else clamp x into [min,max] and print the result....
3 views
24 Jan 2026
Two big integers are given as strings (may be negative). Print -1 if A < B, 0 if equal, 1 if A > B....
4 views
24 Jan 2026
Bytes amount is given. Print size in B, KB, MB, or GB with 2 decimals (base 1024). Example: 1536 -> 1.50 KB....
4 views
24 Jan 2026
You get a JSON object having numeric keys and a length. Build a real array of that length. If a key is missing, keep null there. Print the array as JSON....
4 views
24 Jan 2026
You get a JSON array. For each item print PLAIN if it is a plain object (typeof object, not null, not array). Else print NO. One output per line....
3 views
24 Jan 2026
You get a JSON array and a type name. Keep only items matching that type (number,string,boolean,null,array,object) and print the resulting JSON array....
4 views
24 Jan 2026
You get n tokens (strings). If a token is a valid finite number, treat it as numeric. Sort numeric tokens by numeric value. Non-numeric tokens come later sorted lexicographically. Print the final list...
5 views
24 Jan 2026
Two JSON values are given on two lines. Check deep equality: primitives compare normally (NaN does not appear in JSON), arrays compare by order, objects compare by keys and values ignoring key order. ...
6 views
24 Jan 2026
Two JSON objects are given on two lines. Merge them deeply: if both values are objects -> merge, if both are arrays -> concatenate, otherwise second value overrides. Print merged object as JSON....
3 views
24 Jan 2026
Two JSON values are given on two lines: schema and value. Schema has field type (number|string|boolean|null|array|object). For array, schema can have items. For object, schema can have props and requi...
5 views
24 Jan 2026
You get a JSON object, then a path string like a.b[0].c. Print the value at that path as JSON. If path does not exist, print null....
7 views
24 Jan 2026
You get a JSON object, a path like a.b[0].c, and a JSON value. Set that path in the object (create objects/arrays when needed). Print updated object as JSON....
4 views
24 Jan 2026
One line has a JSON array as plain text (do NOT parse). Count how many top-level elements are present, ignoring commas inside strings/brackets. Print the count....
6 views
24 Jan 2026
Given a JSON object, create canonical JSON by sorting keys recursively, then compute 32-bit FNV-1a hash of that canonical string. Print hash as unsigned integer....
3 views
24 Jan 2026
You get a query string like key=value&key=value. Decode %xx and + as space. Convert values: 'true'/'false' -> boolean, numbers -> number, else string. Repeated keys become arrays. Print JSON object....
3 views
24 Jan 2026
Input is a JSON value as text (may contain spaces and new lines). Without parsing it, remove all whitespace that is outside string literals. Print the minified JSON text....
4 views
24 Jan 2026
One string is given. Print YES if it is a valid JavaScript identifier using only ASCII rules: first char is letter/_/$, next chars are letters/digits/_/$. Otherwise NO....
4 views
24 Jan 2026
You have a button #btn and a text box #box. On click, toggle #box display between block and none....
2 views
24 Jan 2026
You have and . While typing, show current character count inside #count....
2 views
24 Jan 2026
You have , , and
. On button click, add a new - with input text (trim). Ignore if empty....
4 views
24 Jan 2026
You have many elements with class card. When any card is clicked, remove only that card from DOM....
2 views
24 Jan 2026
You have a table with rows inside . Add class even-row to every even row (2nd, 4th, ...)....
3 views
24 Jan 2026
You have and . On click, change input type between password and text, and update button text to SHOW/HIDE....
3 views
24 Jan 2026
You have a form #f with inputs having attribute data-req=1. Disable button #submit until all required inputs have some value (trimmed)....
2 views
24 Jan 2026
You have a button #once. When clicked first time, set its text to DONE and disable it. Further clicks should not run the handler logic....
2 views
24 Jan 2026
You have
and . On page load, read data-id and show it inside #out....
2 views
24 Jan 2026
You have
where each - contains text and a Delete. Items can be added later. On clicking Delete, remove that
- . Use event delegation....
3 views
24 Jan 2026
You have and many items with class item inside #list. Filter items by text content (case-insensitive). Debounce the filtering by 300ms....
3 views
24 Jan 2026
You have buttons with class tab-btn and data-tab=panelId. Panels have class tab-panel and id matching data-tab. On click, show only that panel and add class active on the clicked button....
5 views
24 Jan 2026
You have sections .acc where each has a header .acc-head and body .acc-body. On clicking header, toggle its body. Close other bodies in the same container....
5 views
24 Jan 2026
You have #open button and a modal #modal with a close button #close. On open show modal (add class show). On close/ESC click hide it (remove class show)....
3 views
24 Jan 2026
You have anchor links with class jump and href like #section1. On click, prevent default and smoothly scroll to the target element....
2 views
24 Jan 2026
You have . On click, copy data-copy text to clipboard and change button text to COPIED for 1 second....
3 views
24 Jan 2026
You have a form #f and a
. On submit, prevent default and print JSON of all fields into #out. Multiple same-name fields should become an array....
5 views
24 Jan 2026
Images have data-src and class lazy. When an image is near viewport, set its src from data-src and remove class lazy. Use IntersectionObserver....
2 views
24 Jan 2026
You have
. When user scrolls near bottom (within 200px), append 10 new
Item N
. Keep count with variable start....
3 views
24 Jan 2026
You have a box #box and a handle #handle in its bottom-right corner. On dragging handle, resize the box (width/height) with minimum 100px....
8 views
24 Jan 2026
You have and a . Save textarea value to localStorage key note_text on input (debounced 200ms). On load, restore. Clear button removes storage and clears textarea....
3 views
24 Jan 2026
You have a table #t with . Rows are in . On clicking a header, sort rows by that column text. Toggle asc/desc each time....
4 views
24 Jan 2026
You have and . Show how many characters left. If limit exceeded, add class bad on #text....
5 views
24 Jan 2026
Elements with attribute data-tip should show a tooltip div near mouse on hover and hide on mouse leave....
3 views
24 Jan 2026
You have a container #view and multiple templates , etc. Use location.hash (like #home). On hash change, render matching template into #view. Default to home....
2 views
24 Jan 2026
You have
with - . Allow user to reorder list items by drag and drop....
5 views
24 Jan 2026
You have #modal with focusable elements and class show means open. When open, trap Tab/Shift+Tab inside modal. ESC closes....
5 views
24 Jan 2026
You have a container #list with fixed height and overflow auto. Render 10000 rows but keep only visible rows in DOM using virtualization. Row height is 30px....
3 views
24 Jan 2026
You have , , . Keep history of changes (max 50). Undo/redo should update textarea value....
4 views
24 Jan 2026
You have a container #article where headings are
. Prefix each heading text with its number like '1. Title'. If headings change later, auto re-number....
3 views
24 Jan 2026
You have
with and
. Implement open/close and keyboard: Enter/Space opens, ArrowDown/ArrowUp moves focus inside list, E...
4 views
24 Jan 2026
You have #btn and #src (text input). On click copy #src value. Use navigator.clipboard when available, else fallback using a hidden textarea and document.execCommand('copy'). Show result in #msg....
4 views
24 Jan 2026
You have thumbnails .thumb with data-full URL. On click, open overlay #light with . Clicking overlay closes. ESC closes too....
4 views
24 Jan 2026
Two integers a and b are given. If b is 0, handle it safely and print ERR. Otherwise print integer division result (truncate towards zero)....
4 views
24 Jan 2026
One token is given. If it is a valid base-10 integer (like -12, 0, 99) print its double. Else print INVALID. Use try/catch for validation....
3 views
24 Jan 2026
One line text is given. If after trim it becomes empty, throw error EMPTY and print EMPTY. Else print trimmed length....
3 views
24 Jan 2026
One token is given. Convert to BigInt safely. If conversion fails, print BAD. Else print value+1....
3 views
24 Jan 2026
One line is given (supposed to be JSON). If it parses, print it back as JSON string. If parsing fails, print {}....
3 views
24 Jan 2026
Input has a JSON object in line1 and a key in line2. If key is present (own property), print its value as JSON. Else print MISSING....
4 views
24 Jan 2026
Three integers x min max are given. If min > max, handle the error and print BAD_RANGE. Else clamp x into [min,max] and print it....
3 views
24 Jan 2026
One integer x is given. In try block add 1, and if x...
2 views
24 Jan 2026
One integer n is given. Create a promise that rejects if n is odd, else resolves. Using async/await and try/catch, print OK or ERR....
3 views
24 Jan 2026
One line has space separated tokens. Add only tokens that are valid finite numbers. Count bad tokens (NaN/Infinity/non-number). Print: sum badCount....
4 views
24 Jan 2026
Two integers workMs and timeoutMs are given. Simulate a task that resolves after workMs. If it does not finish within timeoutMs, print TIMEOUT else DONE....
4 views
24 Jan 2026
Input has attempts and failCount. A task fails first failCount times then succeeds. Retry using async/await. Print SUCCESS if it succeeds within attempts else FAIL....
4 views
24 Jan 2026
One word is given. If it is NEG, throw error NEG inside inner(). Outer should catch it, wrap as OUTER and attach cause. Finally print messages chain like OUTER->NEG....
3 views
24 Jan 2026
One JSON object is given with fields name, age, email. Check: name is non-empty string, age is integer 1..120, email contains @. Print OK if valid else print all errors joined by ;...
6 views
24 Jan 2026
First line n, then n lines each should be a JSON number. Sum valid numbers. Count how many lines were bad JSON or not a finite number. Print: sum badCount....
3 views
24 Jan 2026
One line text is given. First try JSON.parse. If it fails, try Number() and if finite print NUMBER . Else print STRING ....
3 views
24 Jan 2026
One integer status code is given. If status is 400 or more, throw HttpError with message BAD_REQUEST for 400-499 and SERVER_ERROR for 500+. Catch and print: status message. If ...
3 views
24 Jan 2026
First line n and then n lines (any JSON). Parse line by line. If a line is invalid JSON, print BAD k (1-based) and stop. If all ok, print OK....
3 views
24 Jan 2026
One date string is given in format YYYY-MM-DD. Validate it properly (real calendar). If invalid print INVALID else print DAYOFWEEK as 0..6 (0=Sunday)....
3 views
24 Jan 2026
Line1 is JSON object, line2 is a dot path like a.b.c. If path exists print value as JSON. If any step missing, handle error and print null....
3 views
24 Jan 2026
Input has n and failAt. Simulate opening a resource n times in loop and closing in finally. If i equals failAt, throw. Print final openCount (should be 0)....
3 views
24 Jan 2026
Two integers a and b are given. Start a promise with a. In then, if b is 0 throw DIV0 else divide. Catch error and output 0. Otherwise output result....
4 views
24 Jan 2026
You are given an array and update operations. If any operation is invalid (index out of range), rollback everything and print ROLLBACK and original array. Else print OK and final array....
4 views
24 Jan 2026
First line n then n lines, each should be a JSON number. If any line is invalid JSON or not finite number, print LINE k and stop. Otherwise print the sum....
5 views
24 Jan 2026
Line1 is a template with placeholders like {name}. Line2 is a JSON object. Replace placeholders with values. If any key is missing, print MISSING key. Else print final string....
3 views
24 Jan 2026
One line expression has digits, + - * / ( ) and spaces. Evaluate with correct precedence. If any invalid character appears, print ERR pos (1-based index in original string)....
3 views
24 Jan 2026
You get n numbers and limit k. Each task rejects if number is odd, resolves if even. Run tasks in order with concurrency 3. Stop starting new tasks after failures become > k. Print startedCount failCo...
4 views
24 Jan 2026
Line1 is JSON object. Line2 has integer q. Next q lines are paths like a.b[0].c. If any path missing, collect them and print MISSING count and list. Else print OK....
4 views
24 Jan 2026
Input has n lines. Some lines look like ERROR:CODE where CODE is a word. Count each code and print in descending count, tie by code. Ignore lines that do not match....
3 views
24 Jan 2026
First line n then n lines. Each line must have exactly 3 comma-separated parts (no escaping). For each line, if it is valid count it as ok, else count as bad. Print: ok bad....
4 views
24 Jan 2026
First line balance. Next line m. Next m lines are operations: DEBIT x or CREDIT x. If any debit makes balance negative, rollback all and print ROLLBACK and original balance. Else print COMMIT and fina...
6 views
24 Jan 2026
Two JSON objects are given on two lines. Deep merge them: object+object merges keys, array+array concatenates, primitives override. But if types mismatch (like object vs array), stop and print TYPE_MI...
4 views
23 Jan 2026
Return the first element from a JavaScript array....
4 views
23 Jan 2026
Return total number of elements in a JavaScript array....