mirror of
				https://gitee.com/coder-xiaomo/leetcode-problemset
				synced 2025-11-04 19:53:12 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			43 lines
		
	
	
		
			970 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			43 lines
		
	
	
		
			970 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
<p>某公司组织架构以二叉搜索树形式记录,节点值为处于该职位的员工编号。请返回第 <code>cnt</code> 大的员工编号。</p>
 | 
						||
 | 
						||
<p> </p>
 | 
						||
 | 
						||
<p><strong>示例 1:</strong></p>
 | 
						||
 | 
						||
<p><img alt="" src="https://pic.leetcode.cn/1695101634-kzHKZW-image.png" style="height: 281px; width: 500px;" /></p>
 | 
						||
 | 
						||
<pre>
 | 
						||
<strong>输入:</strong>root = [7, 3, 9, 1, 5], cnt = 2
 | 
						||
       7
 | 
						||
      / \
 | 
						||
     3   9
 | 
						||
    / \
 | 
						||
   1   5
 | 
						||
<strong>输出:</strong>7
 | 
						||
</pre>
 | 
						||
 | 
						||
<p><strong>示例 2:</strong></p>
 | 
						||
 | 
						||
<p><img alt="" src="https://pic.leetcode.cn/1695101636-ESZtLa-image.png" style="height: 281px; width: 500px;" /></p>
 | 
						||
 | 
						||
<pre>
 | 
						||
<strong>输入:</strong> root = [10, 5, 15, 2, 7, null, 20, 1, null, 6, 8], cnt = 4
 | 
						||
       10
 | 
						||
      / \
 | 
						||
     5   15
 | 
						||
    / \    \
 | 
						||
   2   7    20
 | 
						||
  /   / \ 
 | 
						||
 1   6   8
 | 
						||
<strong>输出:</strong> 8</pre>
 | 
						||
 | 
						||
<p> </p>
 | 
						||
 | 
						||
<p><strong>提示:</strong></p>
 | 
						||
 | 
						||
<ul>
 | 
						||
	<li>1 ≤ cnt ≤ 二叉搜索树元素个数</li>
 | 
						||
</ul>
 | 
						||
 | 
						||
<p> </p>
 |