Code Challenges

Get better at coding with practice problems.

Coding Challenges

Select a problem, write code, run test cases, and submit your solution.

Showing 19 of 159 problems

Implement the linearSearchIndex method that returns the first index of the target using linear search. Solved

Implement the mergeTwoSortedArrays method that merges two sorted arrays into one sorted result array. Solved

Implement the findFirstRepeatedValue method that returns the first value that appears more than once while scanning the array. Solved

Implement the maximumSubarraySumFixedLength method that finds the maximum sum of any contiguous subarray of length k. Solved

Implement the countDistinctValues method that counts how many different values are present in the array. Solved

Implement the hasPairWithExactDifference method that checks whether any two values in the array have the required absolute difference. Solved

Implement the findMissingNumberFromOneToN method that finds the missing value from a sequence that should contain numbers from 1 to n. Solved

Learner

Implement the rightRotateArrayByOne method that returns the array after rotating all elements one position to the right. Solved

Learner

Implement the leftRotateArrayByOne method that returns the array after rotating all elements one position to the left. Solved

Intermediate

Implement the findSecondLargestDistinct method that returns the second largest distinct value from the array. Solved

Implement the moveZerosToEndCopy method that returns a copy of the array with all zero values moved to the end. Solved

Implement the isArrayStrictlyIncreasing method that checks whether every array element is greater than the element before it. Solved

Implement the reverseArrayCopy method that returns a new array with the input elements in reverse order. Solved

Proficient

Implement the method trappedRainWater that calculates how much water can be trapped between bars. Solved

Implement the method longestIncreasingSubsequence that returns the length of the longest strictly increasing subsequence. Solved

Proficient

Implement the method minJumpsToEnd that returns the fewest jumps needed to reach the last index. Solved

Intermediate

Implement the method searchRotatedArray that finds a target in a rotated sorted array. Solved

Intermediate

Implement the method majorityElement that returns the value appearing more than half the time. Solved