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
Intermediate

Implement the method compressRuns that compresses consecutive repeated characters. Solved

Implement the method reverseWords that reverses the order of words in a string. Solved

Intermediate

Implement the method isBalancedBrackets that checks whether brackets are correctly nested. Solved

Implement the method longestCommonPrefix that returns the shared starting text of all strings. Solved

Intermediate

Implement the method searchRotatedArray that finds a target in a rotated sorted array. 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

Learner

Implement the method productSign that returns the sign of the product of an integer array. Solved

Implement the method firstOccurrence that returns the first index of a target value in a sorted array. Solved

Beginner

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

Intermediate

Implement the method firstNonRepeatingChar that returns the first non-repeating character in a string. Solved

Beginner

Implement the method celsiusToFahrenheit that converts Celsius to Fahrenheit. Solved

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

Beginner

Implement the method sumOfSquares that returns the sum of squares from 1 to n. Solved

Learner

Implement the method fibonacci that returns the nth Fibonacci number. Solved

Implement the method gcd that returns the greatest common divisor of two integers. Solved

Beginner

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