mirror of
				https://gitee.com/coder-xiaomo/leetcode-problemset
				synced 2025-11-04 19:53:12 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			20 lines
		
	
	
		
			500 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			20 lines
		
	
	
		
			500 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
<p>Given an M x N matrix in which each row and each column is sorted in ascending order, write a method to find an element.</p>
 | 
						|
 | 
						|
 | 
						|
 | 
						|
<p><strong>Example:</strong></p>
 | 
						|
 | 
						|
 | 
						|
 | 
						|
<p>Given matrix:</p>
 | 
						|
 | 
						|
 | 
						|
 | 
						|
<pre>
 | 
						|
 | 
						|
[
 | 
						|
 | 
						|
  [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]
 | 
						|
 | 
						|
]
 | 
						|
 | 
						|
</pre>
 | 
						|
 | 
						|
 | 
						|
 | 
						|
<p>Given target = 5, return <code>true.</code></p>
 | 
						|
 | 
						|
 | 
						|
 | 
						|
<p>Given target = 20, return <code>false.</code></p>
 | 
						|
 |