Adding solution to prot.  Fixed the lookup table to go from O(N)
to ~O(logN)