C++/C# divide and conquer solution
C++ version\n\n    bool searchMatrix(vector>& matrix, int target) {\n        // check bad input\n        int m = matrix.size();\n        if(m == 0)\n           
C++ version\n\n    bool searchMatrix(vector<vector<int>>& matrix, int target) {\n        // check bad input\n        int m = matrix.size();\n        if(m == 0)\n            return false;\n        int n = matrix[0].size();\n        if(n == 0)\n            return false;\n        return binarySearch(matrix, target, 0, m-1, 0, n-1);\n    }\n    \n    bool binarySearch(vector<vector<int>>& matrix, int target, \n    int min_i, int max_i, \n    int min_j, int max_j){\n        if(min_i > max_i)\n            return false;\n        if(min_j > max_j)\n            return false;\n        int i = (min_i + max_i)/2;\n        int j = (min_j + max_j)/2;\n        \n        int value = matrix[i][j];\n        if(value == target)\n            return true;\n        else if(value < target)\n        {\n            return binarySearch(matrix, target, min_i, max_i, j+1, max_j)\n            || binarySearch(matrix, target, i+1, max_i, min_j, j);\n        }\n        else\n        {\n            return binarySearch(matrix, target, min_i, max_i, min_j, j-1)\n            || binarySearch(matrix, target, min_i, i-1, j, max_j);            \n        }\n    }\n\nC# version\n\n    public bool SearchMatrix(int[,] matrix, int target) {\n        if(matrix == null)\n            return false;\n        int m = matrix.GetLength(0);\n        int n = matrix.GetLength(1);\n        if(n == 0 && m == 0)\n            return false;\n        return BinarySearch(matrix, target, 0, m-1, 0, n-1);\n    }\n    \n    bool BinarySearch(int[,] matrix, int target, \n    int min_i, int max_i, \n    int min_j, int max_j){\n        if(min_i > max_i)\n            return false;\n        if(min_j > max_j)\n            return false;\n        int i = (min_i + max_i)/2;\n        int j = (min_j + max_j)/2;\n        \n        int value = matrix[i,j];\n        if(value == target)\n            return true;\n        else if(value < target)\n        {\n            return BinarySearch(matrix, target, min_i, max_i, j+1, max_j)\n            || BinarySearch(matrix, target, i+1, max_i, min_j, j);\n        }\n        else\n        {\n            return BinarySearch(matrix, target, min_i, max_i, min_j, j-1)\n            || BinarySearch(matrix, target, min_i, i-1, j, max_j);            \n        }\n    }
['Divide and Conquer', 'C++']