4 lines C, 6 lines Ruby, 7 lines Python, 1-liners
Same O(m+n) method as most, just a bit different style/languages.\n\n---\n\nC\n\nCheck the top-right corner. If it's not the target, then remove the top row or 
Same O(m+n) method as most, just a bit different style/languages.\n\n---\n\n**C**\n\nCheck the top-right corner. If it's not the target, then remove the top row or rightmost column.\n\n    bool searchMatrix(int** A, int m, int n, int target) {\n        int x = ~target;\n        while (m && n && (x = A[0][n-1]) != target)\n            x < target ? A++, m-- : n--;\n        return x == target;\n    }\n\n**Ruby**\n\n    def search_matrix(matrix, target)\n        j = -1\n        matrix.each { |row|\n            j -= 1 while row[j] && row[j] > target\n            return true if row[j] == target\n        }\n        false\n    end\n\n**Python**\n\n    def searchMatrix(self, matrix, target):\n        j = -1\n        for row in matrix:\n            while j + len(row) and row[j] > target:\n                j -= 1\n            if row[j] == target:\n                return True\n        return False\n\n**1-liners**\n\nRelax, I know they're O(mn). This is just for fun (although they did get accepted):\n\nPython (204 ms):\n\n    def searchMatrix(self, matrix, target):\n        return any(target in row for row in matrix)\n\nRuby (828 ms):\n\n    def search_matrix(matrix, target)\n        matrix.any? { |row| row.include? target }\n    end
['Python', 'Ruby']