update old question with simple solution, binary search on matrix, int transformation