Describe
Find a digit from a two-dimensional array ,the array increae from left to right and from top to buttom
Code:
func findNumberIn2DArray(matrix [][]int, target int) bool {
if len(matrix)==0{
return false
}
row:=0
column:=len(matrix[0])-1
rowMax:=len(matrix)
for row < rowMax && column >=0 {
if matrix[row][column] == target {
return true
}else if matrix[row][column] > target{
column--
}else{
row++
}
}
return false
}