R2 (code design round) :
Design a middleware router
/**
interface Router {
fun addRoute(path: String, result: String) : Unit;
fun callRoute(path: String) : String;
}
Usage:
Router.addRoute("/bar", "result")
Router.callRoute("/bar") -> output : "result"
Router.addRoute("/foo/bar", "result2")
Router.callRoute("/foo/bar") -> output: "result2"
**/
R3 (Data structure) :
/*
Imagine we have a system that stores files, and these files can be grouped into collections. We are interested in knowing where our resources are being taken up.
For this system we would like to generate a report that lists:
The total size of all files stored; and
The top N collections (by file size) where N can be a user-defined value
An example input into your report generator might look like:
file1.txt (size: 100)
file2.txt (size: 200) in collection "collection1"
file3.txt (size: 200) in collection "collection1"
file4.txt (size: 300) in collection "collection2"
file5.txt (size: 10)
output :
total size = 100+400+300+10 = 810
top 2 collection = collection1
collection2
*/
Got rejected even after correct solution in both round. #shitlassian


