Graphs.. I really need to get used to non-linear data structure moving forward. This problem took me a while to understand, and I could only understand the first iteration of possible solutions.
n is total of stones and e is edge
O(n ^ 2 e) time and O(n e) space complexity