Think in Scala & master the highest paid programming language in the US

Scala is used at many places, such as AirBnB, Apple, Citibank, Coursera, eBay, JP Morgan, LinkedIn, Morgan Stanley, Netflix, Twitter.

Study our 86 Scala Algorithms: 6 fully free, 50 published & 36 upcoming

Fully unit-tested, with explanations and relevant concepts; new algorithms published about once a week.

  1. Monitor success rate of a process that may fail
  2. Find k closest elements to a value in a sorted Array
  3. Quick Sort sorting algorithm in pure immutable Scala
  4. Find minimum missing positive number in a sequence
  5. Compute a Roman numeral for an Integer, and vice-versa
  6. Matching parentheses algorithm with foldLeft and a state machine
  7. Traverse a tree Breadth-First, immutably
  8. Read a matrix as a spiral
  9. Remove duplicates from a sorted list (state machine)
  10. Merge Sort: stack-safe, tail-recursive, in pure immutable Scala, N-way
  11. Longest increasing sub-sequence length
  12. Binary search a generic Array
  13. Merge Sort: in pure immutable Scala
  14. Is an Array a permutation?
  15. Count number of contiguous countries by colors
  16. Add numbers without using addition (plus sign)
  17. Tic Tac Toe MinMax solve
  18. Run-length encoding (RLE) Encoder
  19. Print Alphabet Diamond
  20. Balanced parentheses algorithm with tail-call recursion optimisation
  21. Reverse a String's words efficiently
  22. Count number of changes (manipulations) needed to make an anagram with foldLeft and a MultiSet
  23. Counting inversions of a sequence (array) using a Merge Sort
  24. Check if an array is a palindrome
  25. Compute nth row of Pascal's triangle
  26. Run-length encoding (RLE) Decoder
  27. Check if a number is a palindrome
  28. In a range of numbers, count the numbers divisible by a specific integer
  29. Reshape a matrix
  30. Closest pair of coordinates in a 2D plane
  31. Find the contiguous slice with the minimum average
  32. Compute maximum sum of subarray (Kadane's algorithm)
  33. Rotate Array right in pure-functional Scala - using an unusual immutable efficient approach
  34. Length of the longest common substring
  35. Tic Tac Toe board check
  36. Find an unpaired number in an array
  37. Check if a String is a palindrome
  38. Count binary gap size of a number using tail recursion
  39. Remove duplicates from a sorted list (Sliding)
  40. Find sub-array with the maximum sum
  41. Find the minimum absolute difference of two partitions
  42. Find maximum potential profit from an array of stock price
  43. Fibonacci in purely functional immutable Scala
  44. Fizz Buzz in purely functional immutable Scala
  45. Find combinations adding up to N (non-unique)
  46. Count factors/divisors of an integer
  47. Compute single-digit sum of digits
  48. Traverse a tree Depth-First
  49. QuickSelect Selection Algorithm (kth smallest item/order statistic)
  50. Rotate a matrix by 90 degrees clockwise

Explore the 21 most useful Scala concepts

To save you going through various tutorials, we cherry-picked the most useful Scala concepts in a consistent form.

  1. Class Inside Class
  2. Class Inside Def
  3. Collect
  4. Def Inside Def
  5. Drop, Take, dropRight, takeRight
  6. foldLeft and foldRight
  7. For-comprehension
  8. Lazy List
  9. Option Type
  10. Ordering
  11. Partial Function
  12. Pattern Matching
  13. Range
  14. scanLeft and scanRight
  15. Sliding / Sliding Window
  16. Stack Safety
  17. State machine
  18. Tail Recursion
  19. Type Class
  20. View
  21. Zip

Register now (free)


How the algorithms look

  1. A description/goal of the algorithm.
  2. An explanation with both Scala and logical parts.
  3. A proof or a derivation, where appropriate.
  4. Links to Scala concepts used in this specific algorithm, also unit-tested.
  5. An implementation in pure-functional immutable Scala, with efficiency in mind (for most algorithms, this is for paid subscribers only).
  6. Unit tests, with a button to run them immediately in our in-browser IDE.
Screenshot of an example algorithm demonstrating the listed features

What our users say


Register now (free)