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

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

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

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

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

Even Or Odd Batch

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

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

Min Of Three (T Times)

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

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

Prefix Sums Print

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

Batch GCD

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Fast Fibonacci Mod

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

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

Longest Palindromic Subsequence Length

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

Largest Rectangle In Histogram

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

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

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