Welcome to Scala Algorithms!

The table of Scala Algorithms
#1Longest increasing sub-sequence lengthLongest increasing sub-sequence length

Free test cases & hints

#2Counting inversions of a sequence (array) in pure-functional immutable Scala, using a Merge SortCounting inversions of a sequence

Free test cases & hints

#3Check if an array is a palindrome in pure immutable ScalaCheck if an array is a palindrome in pure immutable Scala

Free

#4Matching parentheses algorithm in immutable/pure functional Scala with foldLeft and a state machineMatching parentheses algorithm in immutable/pure functional Scala with foldLeft and a state machine

Free test cases & hints

#5Traverse a tree Breadth-First, immutably, and purely in ScalaTraverse a tree Breadth-First, immutably, and purely in Scala

Free test cases & hints

#6Merge Sort: in pure immutable ScalaMerge Sort: in pure immutable Scala

Free test cases & hints

#7Balanced parentheses algorithm in immutable/pure functional Scala with tail-call recursion optimisationBalanced parentheses algorithm in immutable/pure functional Scala with tail-call recursion optimisation

Free

#8Count number of changes (manipulations) needed to make an anagram in immutable/pure functional Scala with foldLeft and a MultiSetCount number of changes (manipulations) needed to make an anagram in immutable/pure functional Scala with foldLeft and a MultiSet

Free test cases & hints

#9Check if a number is a palindrome in pure immutable ScalaCheck if a number is a palindrome in pure immutable Scala

Free test cases & hints

#10Compute maximum sum of subarray (Kadane's algorithm) in purely functional immutable ScalaCompute maximum sum of subarray (Kadane's algorithm) in purely functional immutable Scala

Free test cases & hints

#11Rotate Array right in pure-functional Scala - using an unusual immutable efficient approachRotate Array right in pure-functional Scala

Free test cases & hints

#12Find an unpaired number in an arrayFind an unpaired number in an array

Free

#13Check if a String is a palindrome in immutable ScalaCheck if a String is a palindrome in immutable Scala

Free test cases & hints

#14Count binary gap size of a number in immutable/pure functional Scala using tail recursionCount binary gap size of a number in immutable/pure functional Scala using tail recursion

Free

#15Find sub-array with the maximum sumFind sub-array with the maximum sum

Free test cases & hints

#16Find maximum potential profit from an array of stock prices - pure-functional immutable Scala solutionFind maximum potential profit from an array of stock prices - pure-functional immutable Scala solution

Free

#17Fizz Buzz in purely functional immutable ScalaFizz Buzz in purely functional immutable Scala

Free

#18Traverse a tree Depth-First with purely-functional immutable ScalaTraverse a tree Depth-First with purely-functional immutable Scala

Free test cases & hints

#19Count factors/divisors of an integer in pure-functional immutable ScalaCount factors of a number

Free test cases & hints

#20Closest pair of coordinates in a 2D planeClosest pair of coordinates in a 2D plane

Available 5th November

#21Merge Sort: stack-safe, tail-recursive, in pure immutable Scala, N-wayMerge Sort: stack-safe, tail-recursive

Available 12th November

#22Is an Array a permutation? Pure-functional & immutable Scala algorithmIs an array a permutation?

Available 15th November

#23In a range of numbers, count the numbers divisible by a specific integer. Pure functional solutionCount numbers divisible by another

Available 19th November

#24Fibonacci in purely functional immutable ScalaFibonacci in purely functional immutable Scala

Available 22nd November

#25Quick Sort sorting algorithm in pure immutable ScalaQuick Sort sorting algorithm in pure immutable Scala

Available 26th November

#26Compute a Roman numeral for an Integer, and vice-versaCompute a Roman numeral for an Integer, and vice-versa

Available 29th November

#27Find the minimum absolute difference of two partitionsFind the minimum absolute difference of two partitions

Available 3rd December

#28Tic Tac Toe board checkTic Tac Toe board check

Available 6th December

#29Find the contiguous slice with the minimum averageFind the contiguous slice with the minimum average

Available 10th December

#30Run-length encoding in pure-functional immutable ScalaRun-length encoding in pure-functional immutable Scala

Available 13th December

#31Binary search a generic Array in pure functional ScalaBinary search a generic Array in pure functional Scala

Available 17th December

#32Find minimum positive number missing in a sequenceFind minimum positive number missing in a sequence

Available 20th December

#33Length of the longest common substringLength of the longest common substring

Available 24th December

#34Count number of contiguous countries by colorsCount number of contiguous countries by colors

Available 1st January

#35Read a matrix as a spiral in pure-functional immutable ScalaRead a matrix as a spiral

Available 7th January

#36Rotate a matrix by 90 degrees in pure-functional immutable ScalaRotate a matrix by 90 degrees

Available 14th January

#37Selection Search in pure-function immutable ScalaSelection Search in pure-function immutable Scala

Available 21st January

#38Monitor success rate of a process that may failMonitor success rate of a process that may fail

Available 28th January

#39Reverse a String's words efficientlyReverse a String's words efficiently

Available 4th February

#40Print Alphabet DiamondPrint Alphabet Diamond

Available 11th February

19 available Scala algorithms

A monthly unlimited subscription is available for US$3.99. Visit any paid solution to order a subscription.

  1. Longest increasing sub-sequence length

    Free test cases & hints

  2. Counting inversions of a sequence (array) in pure-functional immutable Scala, using a Merge Sort

    Free test cases & hints

  3. Check if an array is a palindrome in pure immutable Scala

    Free

  4. Matching parentheses algorithm in immutable/pure functional Scala with foldLeft and a state machine

    Free test cases & hints

  5. Traverse a tree Breadth-First, immutably, and purely in Scala

    Free test cases & hints

  6. Merge Sort: in pure immutable Scala

    Free test cases & hints

  7. Balanced parentheses algorithm in immutable/pure functional Scala with tail-call recursion optimisation

    Free

  8. Count number of changes (manipulations) needed to make an anagram in immutable/pure functional Scala with foldLeft and a MultiSet

    Free test cases & hints

  9. Check if a number is a palindrome in pure immutable Scala

    Free test cases & hints

  10. Compute maximum sum of subarray (Kadane's algorithm) in purely functional immutable Scala

    Free test cases & hints

  11. Rotate Array right in pure-functional Scala - using an unusual immutable efficient approach

    Free test cases & hints

  12. Find an unpaired number in an array

    Free

  13. Check if a String is a palindrome in immutable Scala

    Free test cases & hints

  14. Count binary gap size of a number in immutable/pure functional Scala using tail recursion

    Free

  15. Find sub-array with the maximum sum

    Free test cases & hints

  16. Find maximum potential profit from an array of stock prices - pure-functional immutable Scala solution

    Free

  17. Fizz Buzz in purely functional immutable Scala

    Free

  18. Traverse a tree Depth-First with purely-functional immutable Scala

    Free test cases & hints

  19. Count factors/divisors of an integer in pure-functional immutable Scala

    Free test cases & hints

21 upcoming Scala algorithms

  1. Closest pair of coordinates in a 2D plane

    Available 5th November

  2. Merge Sort: stack-safe, tail-recursive, in pure immutable Scala, N-way

    Available 12th November

  3. Is an Array a permutation? Pure-functional & immutable Scala algorithm

    Available 15th November

  4. In a range of numbers, count the numbers divisible by a specific integer. Pure functional solution

    Available 19th November

  5. Fibonacci in purely functional immutable Scala

    Available 22nd November

  6. Quick Sort sorting algorithm in pure immutable Scala

    Available 26th November

  7. Compute a Roman numeral for an Integer, and vice-versa

    Available 29th November

  8. Find the minimum absolute difference of two partitions

    Available 3rd December

  9. Tic Tac Toe board check

    Available 6th December

  10. Find the contiguous slice with the minimum average

    Available 10th December

  11. Run-length encoding in pure-functional immutable Scala

    Available 13th December

  12. Binary search a generic Array in pure functional Scala

    Available 17th December

  13. Find minimum positive number missing in a sequence

    Available 20th December

  14. Length of the longest common substring

    Available 24th December

  15. Count number of contiguous countries by colors

    Available 1st January

  16. Read a matrix as a spiral in pure-functional immutable Scala

    Available 7th January

  17. Rotate a matrix by 90 degrees in pure-functional immutable Scala

    Available 14th January

  18. Selection Search in pure-function immutable Scala

    Available 21st January

  19. Monitor success rate of a process that may fail

    Available 28th January

  20. Reverse a String's words efficiently

    Available 4th February

  21. Print Alphabet Diamond

    Available 11th February