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 50 problems

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

Implement the removeDuplicatesSortedArrayLength method that returns the length after removing duplicates from a sorted array. Solved

Implement the threeSumTripletCount method that counts unique triplets whose sum is zero. Solved

Intermediate

Implement the containerWithMostWaterArea method that returns the maximum water area formed by two vertical lines. Solved

Implement the searchRotatedSortedArrayImportant method that searches for a target in a rotated sorted array using binary search. Solved

Implement the findMedianOfTwoSortedArraysSimple method that returns the floor of the median after combining two sorted arrays. Solved

Implement the countInversionsInArray method that counts pairs that are out of sorted order in the array. Solved

Intermediate

Implement the minimumSwapsToSortSmallArray method that returns the minimum number of swaps needed to sort the array. Solved

Implement the mergeSortedWithoutDuplicates method that merges two sorted arrays while removing duplicate values. Solved