Problem Description
1 S K:
Insert a string S with key K.
2 S K:
find the count of strings having S as prefix and key greater than or equal to K.
A = [1, 1, 2, 1, 2]
B = ["abc", "bac", "ab", "abc", "ab"]
C = [5, 1, 4, 4, 4]
Input 2:
A = [2]
B = [a]
C = [6]
[1, 2]
Output 2:
[0]
- Insert ["abc", 5]
- Insert ["bac", 1]
- string with Key greater than equal 4 having "ab" as prefix is ["abc", 5]; hence answer is 1.
- Insert ["abc", 4]
- string with Key greater than equal 4 having "ab" as prefix are ["abc", 5], ["abc", 4]; hence answer is 2
Explanation 2:
There is no string in data structure so answer is 0.
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a question? Checkout Sample Codes for more details.