inline lookupRank() -- O(n^2) -> O(n) \o/