Count all lists of adjacent nodes stored in an array.
- by Ben Brodie
There are many naive approaches to this problem, but I'm looking for a good solution. Here is the problem (will be implemented in Java):
You have a function foo(int a, int b) that returns true if 'a' is "adjacent" to 'b' and false if 'a' is not adjacent to 'b'. You have an array such as this [1,4,5,9,3,2,6,15,89,11,24], but in reality has a very…