leetcode378

Posted AsenYang

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了leetcode378相关的知识,希望对你有一定的参考价值。

public class Solution {
    public int KthSmallest(int[,] matrix, int k) {
        var row = matrix.GetLength(0);
            var col = matrix.GetLength(1);

            var list = new List<int>();

            for (int i = 0; i < row; i++)
            {
                for (int j = 0; j < col; j++)
                {
                    list.Add(matrix[i, j]);
                }
            }

            list = list.OrderBy(x => x).ToList();
            return list[k - 1];
    }
}

https://leetcode.com/problems/kth-smallest-element-in-a-sorted-matrix/#/description

以上是关于leetcode378的主要内容,如果未能解决你的问题,请参考以下文章

[leetcode]378. 有序矩阵中第K小的元素

leetcode 378. Kth Smallest Element in a Sorted Matrix

Leetcode 378. Kth Smallest Element in a Sorted Matrix

Leetcode378. Kth Smallest Element in a Sorted Matrix

LeetCode 378: Kth Smallest Element in Sorted Matrix

#Leetcode# 378. Kth Smallest Element in a Sorted Matrix