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

Implement the mergeSortedArrayInPlaceResult method that merges two sorted arrays into a sorted result. Solved

Intermediate

Implement the fourSumPairCountSimple method that counts quadruplets that produce the target sum. Solved

Implement the minimumDifferencePairSorted method that returns the smallest difference between any pair after sorting. Solved

Implement the validPalindromeAfterOneRemoval method that checks whether a text can become a palindrome after removing at most one character. Solved

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

Intermediate

Implement the longestSubarrayZeroSumLength method that returns the length of the longest subarray with sum zero. Solved

Intermediate

Implement the minimumIndexSumCommonString method that returns the common string with the smallest index sum. Solved

Intermediate

Implement the findAllDuplicatesCount method that counts duplicate values found in the array. Solved

Intermediate

Implement the validSudokuRowsSimple method that checks whether each row of a Sudoku board is valid. Solved

Intermediate

Implement the topKFrequentValuesCount method that counts how many values belong to the top k frequent values. Solved

Intermediate

Implement the isomorphicStringsCheck method that checks whether two strings follow the same character mapping pattern. Solved

Implement the containsDuplicateWithinK method that checks whether duplicate values appear within distance k. Solved

Intermediate

Implement the subarraySumEqualsKCount method that counts subarrays whose sum equals k. Solved

Intermediate

Implement the longestConsecutiveSequenceLength method that returns the length of the longest consecutive number sequence. Solved

Implement the twoSumUsingMap method that returns two indices that form the target sum using a hash map. Solved