1 public class solution 2 { 3 public bool find(int target, int[][] array) 4 { 5 if (array != null) 6 { 7 int rowcnt = array.length - 1; 8 int colcnt = array[0].length - 1; 9 10 int row = 0; 11 int col = colcnt; 12 13 while (row <= rowcnt && col >= 0) 14 { 15 if (target == array[row][col]) 16 { 17 return true; 18 } 19 else if (target < array[row][col]) 20 { 21 col--; 22 } 23 else 24 { 25 row++; 26 } 27 } 28 return false; 29 } 30 31 return false; 32 } 33 }
如对本文有疑问, 点击进行留言回复!!
使用Visual Studio2019创建C#项目(窗体应用程序、控制台应用程序、Web应用程序)
C#实现获取本地内网(局域网)和外网(公网)IP地址的方法分析
网友评论