Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit b7abec6

Browse files
refactor 677
1 parent 3d87691 commit b7abec6

File tree

1 file changed

+14
-16
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+14
-16
lines changed

src/main/java/com/fishercoder/solutions/_677.java

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,20 @@
66
/**
77
* 677. Map Sum Pairs
88
*
9-
* Implement a MapSum class with insert, and sum methods.
10-
11-
For the method insert, you'll be given a pair of (string, integer).
12-
The string represents the key and the integer represents the value.
13-
If the key already existed, then the original key-value pair will be overridden to the new one.
14-
15-
For the method sum, you'll be given a string representing the prefix,
16-
and you need to return the sum of all the pairs' value whose key starts with the prefix.
17-
18-
Example 1:
19-
20-
Input: insert("apple", 3), Output: Null
21-
Input: sum("ap"), Output: 3
22-
Input: insert("app", 2), Output: Null
23-
Input: sum("ap"), Output: 5
24-
9+
* Implement a MapSum class with insert, and sum methods.
10+
*
11+
* For the method insert, you'll be given a pair of (string, integer).
12+
* The string represents the key and the integer represents the value.
13+
* If the key already existed, then the original key-value pair will be overridden to the new one.
14+
*
15+
* For the method sum, you'll be given a string representing the prefix,
16+
* and you need to return the sum of all the pairs' value whose key starts with the prefix.
17+
*
18+
* Example 1:
19+
* Input: insert("apple", 3), Output: Null
20+
* Input: sum("ap"), Output: 3
21+
* Input: insert("app", 2), Output: Null
22+
* Input: sum("ap"), Output: 5
2523
*/
2624
public class _677 {
2725
public static class Solution1 {

0 commit comments

Comments
 (0)