From a96b65cbfad7f62f3db6b2eab105e4e25c0414c5 Mon Sep 17 00:00:00 2001 From: Jack Sangdahl Date: Fri, 27 Jun 2025 12:23:02 -0600 Subject: chore: remove old cpp and rust solutions --- other/search_2d_matrix.cpp | 35 ----------------------------------- 1 file changed, 35 deletions(-) delete mode 100644 other/search_2d_matrix.cpp (limited to 'other/search_2d_matrix.cpp') diff --git a/other/search_2d_matrix.cpp b/other/search_2d_matrix.cpp deleted file mode 100644 index 3d8ce04..0000000 --- a/other/search_2d_matrix.cpp +++ /dev/null @@ -1,35 +0,0 @@ -// 74. Search a 2D Matrix -#include "leetcode.h" - -/* - * given an 'm x n' integer matrix 'matrxi' with the following two properties: - * - each row is sorted in non-decreasing order. - * - the first integer of each row is greater than the last integer of the - * previous row. given an integer 'target', return true if 'target' is in - * 'matrix', or false otherwise. you must write a solution in 'O(log(m * n))' - * time complexity - */ - -class Solution { -public: - bool searchMatrix(vvd & matrix, int target) { - int rows = matrix.size(), cols = matrix[0].size(), row = 0, col = cols - 1; - while (row < rows && col > -1) { - int curr = matrix[row][col]; - if (curr == target) - return true; - if (target > curr) - row++; - else - col--; - } - return false; - } -}; - -int main() { - Solution obj; - vvd matrix = {{1, 3, 5, 7}, {10, 11, 16, 20}, {23, 30, 34, 60}}; - printf("%d\n", obj.searchMatrix(matrix, 3)); // expect: 1 - printf("%d\n", obj.searchMatrix(matrix, 13)); // expect: 0 -} -- cgit v1.2.3