How to solve Leetcode 378. Kth Smallest Element in a Sorted Matrix