I had my 1st round yesterday.
It had 2 Questions:
Find the string with highest frequency from a given array of strings.
Eg. [“hello”, “world”, “world”, “bar”, “hello”, “hello”] should output “hello” (frequency = 3).
Design data-structure(s) to implement these functions in most efficient way:
Class Solution {
void incr(String s) {} //increment frequency of a string
void decr(String s) {} //decrement frequency of a string
String getMax() {} //return string with maximum frequency
String getMin() {} //return string with minimum frequency
}
Eg.
incr(“hello”)
getMax() -> “hello”
incr(“world”)
incr(“world”)
getMax() -> “world”
decr(“hello”)
getMin() -> “world”
UPDATE:
Had 2nd round of HR interview .
Result: Got The Offer