The collection of Scala algorithms

When you register, this becomes your homepage.

21 Scala concepts

  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

82 Scala Algorithms

#1Balanced parentheses algorithm with tail-call recursion

Free

#2Check if an array is a palindrome

Free

#3Find an unpaired number in an array

Free

#4Count binary gap size of a number using tail recursion

Free

#5Find maximum potential profit from an array of stock price

Free

#6Fizz Buzz in purely functional immutable Scala

Free

#7Binary search in a rotated sorted array

Free test cases & hints

#8Find combinations adding up to N (unique)

Free test cases & hints

#9Find the index of a substring ('indexOf')

Free test cases & hints

#10Reverse bits of an integer

Free test cases & hints

#11Find k closest elements to a value in a sorted Array

Free test cases & hints

#12Reshape a matrix

Free test cases & hints

#13Remove duplicates from a sorted list (Sliding)

Free test cases & hints

#14Remove duplicates from a sorted list (state machine)

Free test cases & hints

#15Find combinations adding up to N (non-unique)

Free test cases & hints

#16Compute single-digit sum of digits

Free test cases & hints

#17Add numbers without using addition (plus sign)

Free test cases & hints

#18Tic Tac Toe MinMax solve

Free test cases & hints

#19Compute nth row of Pascal's triangle

Free test cases & hints

#20Print Alphabet Diamond

Free test cases & hints

#21Reverse a String's words efficiently

Free test cases & hints

#22Monitor success rate of a process that may fail

Free test cases & hints

#23QuickSelect Selection Algorithm

Free test cases & hints

#24Rotate a matrix by 90 degrees

Free test cases & hints

#25Read a matrix as a spiral

Free test cases & hints

#26Count number of contiguous countries by colors

Free test cases & hints

#27Length of the longest common substring

Free test cases & hints

#28Find minimum missing positive number in a sequence

Free test cases & hints

#29Binary search a generic Array

Free test cases & hints

#30Run-length encoding (RLE) Decoder

Free test cases & hints

#31Run-length encoding (RLE) Encoder

Free test cases & hints

#32Find the contiguous slice with the minimum average

Free test cases & hints

#33Tic Tac Toe board check

Free test cases & hints

#34Find the minimum absolute difference of two partitions

Free test cases & hints

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

Free test cases & hints

#36Quick Sort sorting algorithm in pure immutable Scala

Free test cases & hints

#37Fibonacci in purely functional immutable Scala

Free test cases & hints

#38Count numbers divisible by another

Free test cases & hints

#39Is an array a permutation?

Free test cases & hints

#40Merge Sort: stack-safe, tail-recursive

Free test cases & hints

#41Closest pair of coordinates in a 2D plane

Free test cases & hints

#42Counting inversions of a sequence

Free test cases & hints

#43Rotate Array right in pure-functional Scala

Free test cases & hints

#44Count factors of a number

Free test cases & hints

#45Merge Sort: in pure immutable Scala

Free test cases & hints

#46Longest increasing sub-sequence length

Free test cases & hints

#47Matching parentheses algorithm with a state machine

Free test cases & hints

#48Traverse a tree Breadth-First, immutably

Free test cases & hints

#49Count number of changes for making an anagram

Free test cases & hints

#50Check if a number is a palindrome

Free test cases & hints

#51Compute maximum sum of subarray (Kadane's algorithm)

Free test cases & hints

#52Check if a String is a palindrome

Free test cases & hints

#53Find sub-array with the maximum sum

Free test cases & hints

#54Traverse a tree Depth-First

Free test cases & hints

#55Compute the length of longest valid parentheses

Available 13th May

#56Single-elimination tournament tree

Available 20th May

#57Make a queue using stacks (Lists in Scala)

Available 27th May

#58Make a queue using Maps

Available 3rd June

#59Remove duplicates from an unsorted list

Available 10th June

#60Count passing cars

Available 17th June

#61Pure-functional double linked list

Available 24th June

#62Check if a directed graph has cycles

Available 1st July

#63Longest common prefix of strings

Available 8th July

#64Check a directed graph has a routing between two nodes

Available 15th July

#65Make a binary search tree

Available 22nd July

#66Check a binary tree is a search tree

Available 29th July

#67Find height of binary tree

Available 5th August

#68Least-recently used cache (LRU)

Available 12th August

#69Reverse first n elements of a queue

Available 19th August

#70Compute keypad possibilities

Available 26th August

#71Check a binary tree is balanced

Available 2nd September

#72Establish execution order from dependencies

Available 9th September

#73Count pairs of a given expected sum

Available 16th September

#74Compute modulo of an exponent without exponentiation

Available 23rd September

#75Binary heap

Available 30th September

#76Binomial heap

Available 7th October

#77Game of Life

Available 14th October

#78Leaky Bucket Rate Limiter

Available 21st October

#79Token Bucket Rate Limiter

Available 28th October

#80Fixed Window Rate Limiter

Available 4th November

#81Sliding Window Rate Limiter

Available 11th November

#82Compute the steps to transform an anagram only using swaps

Available 18th November

Register for an account →