Given an `m x n` matrix where each row is sorted in ascending order and each column is also sorted in ascending order, write an efficient algorithm to search for a target value.
{
"matrix": [
[
1,
4,
7,
11,
15
],
[
2,
5,
8,
12,
19
],
[
3,
6,
9,
16,
22
],
[
10,
13,
14,
17,
24
],
[
18,
21,
23,
26,
30
]
],
"target": 5
}true{
"matrix": [
[
1,
4,
7,
11,
15
],
[
2,
5,
8,
12,
19
],
[
3,
6,
9,
16,
22
],
[
10,
13,
14,
17,
24
],
[
18,
21,
23,
26,
30
]
],
"target": 20
}false{
"matrix": [
[
-5
]
],
"target": -5
}trueSign in to Run Code and Submit