Twitter Interview Question
Software Engineer / DevelopersCountry: United States
Interview Type: Phone Interview
I implemented that in Java more or less and didn't get through. I think the main takeaways were.
1) Ask a lot of clarifying questions. (How many values are in the file? Are the attributes sorted in any way? What are the attributes?)
2) Know how to do file io. I spent a lot of time trying to figure out what libraries to use and didn't get to implement all my subroutines because of it.
@haroldtreen
Algorithmically, the problem seems easy so I would expect that they are not judging on slick algorithm things but rather on perfect, usable, tested code
If I were wrong about that then I guess there may be ways to speed that general approach up like:
1. Like you said, are the values in the tsvs in the same order and will they always have the same values (speed the extraction of tsv values)?
2. Are there alternative ways to compute the bandwidth/latency (speed extraction of tsv values)?
3. Is there some ordering to the bin values that could be exploited (filenames, date times, etc) (do all files need to be computed )?
There could be lots of reasons why you weren't selected which may have nothing to do with your performance. Don't sweat it- "sometimes you get the bear and sometimes the bear gets you"
Here's an pseudo algorithm that should solve the problem:
- zortlord January 03, 2015average = 0
bandwidth = 0
for each file
_tsv = convert file
_read tsv and populate tempLatency and tempBand
_delete tsv
_average += tempLatency
_bandwidth += tempBand
average /= number of files
return average and bandwidth
If you want to get spiffy, you could try some hashing or something like that if there is a chance the files could be identical or something like that. But I think the approach above is probably the best