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

Implement the searchRangeOfTarget method that returns the first and last position of a target in a sorted array. Solved

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

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

Implement the findFirstRepeatedValue method that returns the first value that appears more than once while scanning the array. Solved

Implement the countDistinctValues method that counts how many different values are present in the array. Solved

Intermediate

Implement the method compressRuns that compresses consecutive repeated characters. Solved

Intermediate

Implement the method majorityElement that returns the value appearing more than half the time. Solved

Intermediate

Implement the method countPairsWithSum that counts index pairs whose values add up to a target. Solved

Beginner

Implement the method countEvenNumbers that returns how many even numbers are in an array. Solved

Implement the method countConsonants that returns the number of consonants in a string. Solved

Beginner

Implement the method countWords that returns the number of words in a string. Solved