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 mergeSortedWithoutDuplicates method that merges two sorted arrays while removing duplicate values. Solved

Implement the findPairWithSortedSum method that checks whether a sorted array contains a pair with the required sum. Solved

Intermediate

Implement the kthSmallestValue method that returns the kth smallest value from the array. Solved

Implement the sortByFrequencyAscending method that sorts values by increasing frequency while resolving ties consistently. Solved

Intermediate

Implement the findRotationCount method that returns how many times a sorted array has been rotated. Solved

Intermediate

Implement the searchInRotatedSortedArray method that searches for a target inside a rotated sorted array. Solved

Intermediate

Implement the sortArrayByAbsoluteValue method that returns the array sorted according to absolute value. Solved

Implement the findSmallestMissingPositiveSorted method that finds the smallest positive integer missing from a sorted array. Solved

Intermediate

Implement the findFirstGreaterThanTarget method that returns the first value greater than the target in a sorted array. Solved

Implement the sortOnlyEvenNumbers method that sorts only the even numbers while keeping odd numbers in their positions. Solved

Learner

Implement the insertionSortArray method that returns the array after sorting it using insertion sort logic. Solved

Learner

Implement the bubbleSortArray method that returns the array after sorting it using bubble sort logic. Solved

Learner

Implement the selectionSortArray method that returns the array after sorting it using selection sort logic. Solved

Learner

Implement the isArraySortedAscending method that checks whether the array is sorted in ascending order. Solved

Implement the findInsertPosition method that returns the index where the target should be inserted in sorted order. Solved

Implement the binarySearchPosition method that returns the index of the target using binary search. Solved

Implement the countTargetInSortedArray method that counts how many times the target appears in a sorted array. Solved

Implement the lastIndexOfTarget method that returns the last index where the target value appears. Solved