4 views
23 Jan 2026
Task: reverse the given int array without using another array. Try using two pointers (start/end) and swap....
4 views
23 Jan 2026
Task: return how many values are even in the given int array. Keep it simple with one loop....
5 views
23 Jan 2026
Task: return true if the array is sorted in non-decreasing order. Compare adjacent elements....
4 views
23 Jan 2026
Task: return the maximum value from a non-empty array....
5 views
23 Jan 2026
Task: return sum of all elements in the array....
10 views
23 Jan 2026
Task: move all zeros to the end while keeping the relative order of non-zero elements....
5 views
23 Jan 2026
Task: rotate the array to the right by k steps without extra array. Use reverse trick....
6 views
23 Jan 2026
Task: return the second largest distinct value. If it does not exist, return Integer.MIN_VALUE....
6 views
23 Jan 2026
Task: array has n-1 numbers from 1..n without duplicates. Return the missing number....
5 views
23 Jan 2026
Task: array is sorted. Return indices of two numbers that sum to target, else [-1,-1]. Use two pointers....
5 views
23 Jan 2026
Task: return how many subarrays have sum exactly k (negative numbers allowed). Use prefix sum + hashmap....
4 views
23 Jan 2026
Task: values can be negative. Return maximum product of any two elements....
4 views
23 Jan 2026
Task: a has size m+n, first m elements valid. b has n elements. Merge b into a in sorted order (in-place)....
4 views
23 Jan 2026
Task: return length of the longest consecutive sequence (order in array does not matter). Use HashSet....
5 views
23 Jan 2026
Task: start with zeros of size n. Each query (l,r,add) adds add to every index in [l,r]. Return final array....