Microsoft | System Design | Implement class to get mostVisited and leastVisited path
Difficulty: MEDIUMCategory: InterviewExperienceFrequency: 1Asked On 2022-07-11Added By Anonymous
Source: Link
Implement the following method of the class.
So that it increment the counter of path when user visitPage
Decrements counter of path when we leave page.
Also, return most visited page path and least visited pages page path on demand.
1PageUserStat{
2 void visitPage(string Path){
3 //increments counter
4 }
5 void leavePage(String Path){
6 //Decrements counter
7 }
8 String getWithMostUsers(){
9 //get most visited path
10 }
11 String getPageWithLeastUsers(){
12 //get least visited path
13 }
14}
15