Functional DFS in Scala
Depth First Search(DFS) is an Algorithm for traversing graphs. DFS explores each node as far as possible before it backtracks. It explores edges in a Depth First manner. Here is...
LeetCode Problem: 763. Partition Labels
Problem description can be found here. What we need to do: A string S of lowercase letters is given. We want to partition this string into as many parts as...
LeetCode 55. Jump Game
Description for this problem can be found here. Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array...
LeetCode Problem: 11. Container With Most Water
Problem description can be found here. What we need to do: Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical...
LeetCode Problem: 49. Group Anagrams
Problem description can be found here So in this problem we need to group all the anagrams together. Here is a scala solution: object Solution { def groupAnagrams(strs: Array[String]): List[List[String]]...