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 permutationInStringCheck method that checks whether the text contains any permutation of the pattern. Solved

Implement the maximumAverageSubarrayFloor method that returns the floor of the maximum average of a fixed-length subarray. Solved

Implement the minimumSizeSubarraySum method that returns the smallest subarray length whose sum reaches the target. Solved

Implement the longestSubstringWithKDistinct method that returns the longest substring length with at most k distinct characters. Solved

Intermediate

Implement the boatsToSavePeopleCount method that returns the minimum boats needed under the weight limit. Solved

Implement the sortedSquaresTwoPointers method that returns squares of sorted values in sorted order. Solved

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