Leetcode Search In Sorted Matrix In Python Using List