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 asteroidCollisionSurvivors method that returns the asteroids that remain after all collisions are resolved. Solved

Implement the minRemoveValidParentheses method that removes the minimum invalid parentheses to make the text valid. Solved

Implement the largestRectangleHistogram method that returns the largest rectangle area possible in a histogram. Solved

Implement the dailyTemperaturesWait method that returns how many days must be waited for a warmer temperature. Solved

Implement the nextGreaterElementArray method that returns the next greater value for each array element. Solved

Implement the validParenthesesMixed method that checks whether mixed parentheses are correctly balanced. Solved

Implement the longestSubarrayAfterDeletingOne method that returns the longest subarray of 1 values after deleting one element. Solved

Implement the fruitIntoBasketsMaxCount method that returns the maximum fruits collected using at most two fruit types. Solved

Implement the maxConsecutiveOnesWithKFlips method that returns the longest run of 1 values after flipping at most k zeroes. Solved

Implement the longestRepeatingCharReplacement method that returns the longest substring length after replacing at most k characters. Solved

Implement the findAnagramStartCount method that counts starting positions where an anagram of the pattern appears. Solved

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