[[1,2,3],[4,5,6]],2,3,6
[1,2]
[[1,2,3]],1,3,2
[0,1]
function findElement( mat , n , m , x ) { // write code here let i = 0 ,j = m-1 while(i<n&&j>=0){ if(mat[i][j] == x) return [i,j] else if(mat[i][j] > x) { j-- }else{ i++ } } return [] }
这道题你会答吗?花几分钟告诉大家答案吧!
扫描二维码,关注牛客网
下载牛客APP,随时随地刷题