Implement the MapSum class:
MapSum() Initializes the MapSum object.
void insert(String key, int val) Inserts the key-val pair into the map. If the key already existed, the original key-value pair will be overridden to the new one.
int sum(string prefix) Returns the sum of all the pairs' value whose key starts with the prefix.
LeetCode Reference: https://leetcode.com/problems/map-sum-pairs/
Tries Data Structure: https://youtu.be/D1TZeARS2jo
Other LeetCode Problems:
Binary Tree Right Side View: https://youtu.be/qSShcrIrdUw
House Robber | Dynamic Programing: https://youtu.be/NAdwES8C48g
Generate Parentheses: https://youtu.be/FrTsckBmdyM
Maximum Subarray Sum | Kadane's Algorithm: https://youtu.be/8HUTuitR65s
Find All Duplicates in an Array: https://youtu.be/5wdQI88O3Mc
#MapSumPair #HashTries #LeetCode677 #Google #Microsoft #Amazon #Facebook