PROBLEM LINK:
Author: Arindam Baidya
Tester: Chinmay Rakshit
Editorialist: Chinmay Rakshit
DIFFICULTY:
CAKEWALK.
PREREQUISITES:
HASHING
PROBLEM:
Given the big integer n you have to find the number of times, an integer q repeats itself in n.
EXPLANATION:
There can be many approaches by the most simple is to use
a map of <char,int> this will store the frequency of each integer (0-9)
let’s take the input “big integer n” as the string now compute the frequency by just traversing each character and storing its count.
print the count as print(m[q]) where q is a character
ALTERNATIVE SOLUTION:
Alternatively, it can be solved by taking the input as long long int as it will encompass the input and store the frequency of each integer in an array[0-9].And then take the input q and print (array[q])
AUTHOR’S AND TESTER’S SOLUTIONS:
Author’s solution can be found here.
Tester’s solution can be found here.