摘要:
1 class Solution { 2 public: 3 bool searchMatrix(vector > &matrix, int target) { 4 int rows, cols; 5 if (!(rows = matrix.size()) || !(cols = matrix[0].size())) return false; 6 int ridx, cur, first = -1, last = rows; 7 while (first + 1 target) {13 ... 阅读全文
摘要:
1 class Solution { 2 public: 3 int removeDuplicates(int A[], int n) { 4 if (n <= 2) return n; 5 int wpos = 1; 6 int dups = 0; 7 int cur, last = A[0]; 8 9 for (int i=1; i<n; i++) {10 cur = A[i];11 dups = (cur == last) ? dup... 阅读全文