File tree 2 files changed +68
-1
lines changed
2 files changed +68
-1
lines changed Original file line number Diff line number Diff line change @@ -56,3 +56,68 @@ var searchMatrix = function(matrix, target) {
56
56
// }
57
57
// return false;
58
58
// };
59
+
60
+
61
+
62
+
63
+ // const searchMatrix = function (matrix, target) {
64
+ // const rowIndex = findRow();
65
+ // if (rowIndex === true) {
66
+ // return true;
67
+ // }
68
+ // if (rowIndex < 0) {
69
+ // return false;
70
+ // }
71
+
72
+ // return findNumInRow(matrix[rowIndex]);
73
+
74
+ // function findRow() {
75
+ // let start = 0;
76
+ // let end = matrix.length - 1;
77
+
78
+ // while (start <= end) {
79
+ // const middle = Math.floor((start + end) / 2);
80
+ // const potentialRow = matrix[middle];
81
+ // const firstNumInRow = potentialRow[0];
82
+ // const lastNumInRow = potentialRow[potentialRow.length - 1];
83
+
84
+ // if (firstNumInRow === target || lastNumInRow === target) {
85
+ // return true;
86
+ // }
87
+
88
+ // if (firstNumInRow < target && lastNumInRow > target) {
89
+ // return middle;
90
+ // }
91
+
92
+ // if (target > lastNumInRow) {
93
+ // start = middle + 1;
94
+ // } else {
95
+ // end = middle - 1;
96
+ // }
97
+ // }
98
+
99
+ // return -1;
100
+ // }
101
+
102
+ // function findNumInRow(row) {
103
+ // let start = 0;
104
+ // let end = row.length - 1;
105
+
106
+ // while (start <= end) {
107
+ // const middle = Math.floor((start + end) / 2);
108
+ // const potentialResult = row[middle];
109
+
110
+ // if (potentialResult === target) {
111
+ // return true;
112
+ // }
113
+
114
+ // if (target > potentialResult) {
115
+ // start = middle + 1;
116
+ // } else {
117
+ // end = middle - 1;
118
+ // }
119
+ // }
120
+
121
+ // return false;
122
+ // }
123
+ // };
Original file line number Diff line number Diff line change @@ -347,4 +347,6 @@ Better order to solve problems
347
347
### Tips && Trics
348
348
349
349
102 . = 199.
350
- 100 . = 101
350
+ 100 . = 101
351
+
352
+ ### Ru companies
You can’t perform that action at this time.
0 commit comments