mirror of
				https://gitee.com/coder-xiaomo/leetcode-problemset
				synced 2025-11-04 11:43:12 +08:00 
			
		
		
		
	国外版
This commit is contained in:
		
							
								
								
									
										25
									
								
								算法题(国外版)/number-of-paths-with-max-score.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								算法题(国外版)/number-of-paths-with-max-score.html
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,25 @@
 | 
			
		||||
<p>You are given a square <code>board</code> of characters. You can move on the board starting at the bottom right square marked with the character <code>'S'</code>.</p>
 | 
			
		||||
 | 
			
		||||
<p>You need to reach the top left square marked with the character <code>'E'</code>. The rest of the squares are labeled either with a numeric character <code>1, 2, ..., 9</code> or with an obstacle <code>'X'</code>. In one move you can go up, left or up-left (diagonally) only if there is no obstacle there.</p>
 | 
			
		||||
 | 
			
		||||
<p>Return a list of two integers: the first integer is the maximum sum of numeric characters you can collect, and the second is the number of such paths that you can take to get that maximum sum, <strong>taken modulo <code>10^9 + 7</code></strong>.</p>
 | 
			
		||||
 | 
			
		||||
<p>In case there is no path, return <code>[0, 0]</code>.</p>
 | 
			
		||||
 | 
			
		||||
<p> </p>
 | 
			
		||||
<p><strong>Example 1:</strong></p>
 | 
			
		||||
<pre><strong>Input:</strong> board = ["E23","2X2","12S"]
 | 
			
		||||
<strong>Output:</strong> [7,1]
 | 
			
		||||
</pre><p><strong>Example 2:</strong></p>
 | 
			
		||||
<pre><strong>Input:</strong> board = ["E12","1X1","21S"]
 | 
			
		||||
<strong>Output:</strong> [4,2]
 | 
			
		||||
</pre><p><strong>Example 3:</strong></p>
 | 
			
		||||
<pre><strong>Input:</strong> board = ["E11","XXX","11S"]
 | 
			
		||||
<strong>Output:</strong> [0,0]
 | 
			
		||||
</pre>
 | 
			
		||||
<p> </p>
 | 
			
		||||
<p><strong>Constraints:</strong></p>
 | 
			
		||||
 | 
			
		||||
<ul>
 | 
			
		||||
	<li><code>2 <= board.length == board[i].length <= 100</code></li>
 | 
			
		||||
</ul>
 | 
			
		||||
		Reference in New Issue
	
	Block a user