PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#BS0000097. Tìm số trong ma trận hàng và cột có thứ tự (Search a 2D Matrix II)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Tìm số trong ma trận hàng và cột có thứ tự (Search a 2D Matrix II)
Search a 2D Matrix II
Source: LeetCode
Version: Phuoc Hung OJ Extended
Problem Statement
Given an integer matrix non-decreasing across every row and down every column, determine whether target occurs.
Input
The first line contains , followed by rows of integers each.
Output
Print true if occurs, otherwise false.
Subtasks
- Subtask 1 (20 points): ; ; all rows and columns are non-decreasing.
- Subtask 2 (30 points): ; ; all rows and columns are non-decreasing.
- Subtask 3 (50 points): ; ; all rows and columns are non-decreasing.
Examples
Input
3 3 5
1 4 7
2 5 8
3 6 9
Output
true
Explanation
The entry at row , column is , equal to the target, so output true.