GCD Function

Easy
3 views 25 Jan 2026
Write a gcd(a,b) function and print gcd for the given inputs....

Palindrome Function

Easy
3 views 25 Jan 2026
Create a function isPalindrome(s) that ignores spaces and case. Print YES or NO....

Count Vowels Function

Easy
6 views 25 Jan 2026
Write a function that counts vowels in a string (a,e,i,o,u)....

Rectangle Area Function

Easy
4 views 25 Jan 2026
Write area(w,h) and print the rectangle area....

Reverse String Function

Easy
4 views 25 Jan 2026
Write a function reverseStr(s) and print the reversed string....

Recursive Factorial

Medium
4 views 25 Jan 2026
Compute n! using recursion (n...

Fibonacci with Memo

Medium
4 views 25 Jan 2026
Compute fib(n) with memoization (fib(0)=0, fib(1)=1)....

Sort Strings by Length

Medium
3 views 25 Jan 2026
Sort n strings by length, and for equal length sort lexicographically....

Apply f(x)=2x+1 Twice

Medium
4 views 25 Jan 2026
Given x, apply f(x)=2x+1 two times and print the result....

Square Every Number

Medium
3 views 25 Jan 2026
Given n numbers, use a function to square each and print the squared list....

Bracket Check Function

Medium
4 views 25 Jan 2026
Write a function balanced(s) for () only. Print YES or NO....

Merge Two Sorted Arrays

Medium
4 views 25 Jan 2026
Given two sorted arrays, merge them using a function and print the merged list....

Binary Search Queries

Hard
4 views 25 Jan 2026
Given a sorted array and q queries, use a function to binary search each query. Print 0-based index or -1....

Evaluate Postfix Expression

Hard
4 views 25 Jan 2026
Given a postfix expression with integers and ops + - * /, evaluate it using helper functions....

Closure Counter

Hard
5 views 25 Jan 2026
Create a counter() closure that returns 1,2,3,... each time it is called. Input q, print q lines of counts....

Compose Two Functions

Hard
3 views 25 Jan 2026
Input x. Define f(x)=x+3 and g(x)=x*2. Compute g(f(x)) and f(g(x)) and print both....

Generate Permutation by Swaps

Hard
4 views 25 Jan 2026
Given n and a list of swaps (i j), start with [1..n]. Apply swaps and print the final array....

Group Words by First Letter

Hard
5 views 25 Jan 2026
Given n words, group them by first letter (a-z) and print counts per letter present in sorted order....

Top K Frequent Numbers

Hard
5 views 25 Jan 2026
Given n numbers and k, print the k most frequent numbers. If frequencies tie, smaller number first....

Merge Intervals (Function)

Hard
7 views 25 Jan 2026
Given n intervals, merge overlaps and print the merged intervals sorted by start....