1301. Number of Paths with Max Score Hard

@problem@discussion
#Array#Dynamic Programming#Matrix



1/**
2 * [1301] Number of Paths with Max Score
3 *
4 * You are given a square board of characters. You can move on the board starting at the bottom right square marked with the character 'S'.
5 * 
6 * You need to reach the top left square marked with the character 'E'. The rest of the squares are labeled either with a numeric character 1, 2, ..., 9 or with an obstacle 'X'. In one move you can go up, left or up-left (diagonally) only if there is no obstacle there.
7 * 
8 * 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, taken modulo 10^9 + 7.
9 * 
10 * In case there is no path, return [0, 0].
11 * 
12 *  
13 * Example 1:
14 * Input: board = ["E23","2X2","12S"]
15 * Output: [7,1]
16 * Example 2:
17 * Input: board = ["E12","1X1","21S"]
18 * Output: [4,2]
19 * Example 3:
20 * Input: board = ["E11","XXX","11S"]
21 * Output: [0,0]
22 * 
23 *  
24 * Constraints:
25 * 
26 * 
27 * 	2 <= board.length == board[i].length <= 100
28 * 
29 */
30pub struct Solution {}
31
32// problem: https://leetcode.com/problems/number-of-paths-with-max-score/
33// discuss: https://leetcode.com/problems/number-of-paths-with-max-score/discuss/?currentPage=1&orderBy=most_votes&query=
34
35// submission codes start here
36
37impl Solution {
38    pub fn paths_with_max_score(board: Vec<String>) -> Vec<i32> {
39        vec![]
40    }
41}
42
43// submission codes end
44
45#[cfg(test)]
46mod tests {
47    use super::*;
48
49    #[test]
50    fn test_1301() {
51    }
52}
53


Back
© 2025 bowen.ge All Rights Reserved.