Adobe Interview Question
Software Engineer / DevelopersBad bad bad programmers...
No - no coding. Thou shall not code unless it is needed!
These do not need coding at all.
You need POSIX commands like
1. grep
2. ls
3. cut
That is it.
dude...you're a moron and i hope you realize that...if you have ever interviewed with amazon/ms you will know that they dont care about linux/unix commands at all...they want to test your data structures/algorithms knowledge and application skills...no offense...ive seen your answers to other questions and you should open your eyes..Peace!
I wonder how this can be implemented straightforwardly using a sequence of commands without using branching instructions like 'if' etc. If we are to using branching then in that case you are to resort to some programming like shell scripting. We can use awk or perl. But I really doubt whether we can just use a sequence of commands like the ones (or similar) mentioned above directly and get the outcome.
@lol, this is not a place to spew out rants, if someone starts thinking your way then he'll make his/her life extremely complex and miserable. dont make things complex if they are really simple. Thats what is suggested by Lord Darth and he is really right. knowing commands and making the proper use of it is a different ball game. Peace^999 !!!
Has anybody considered the remote possiblity of the question ACTUALLY being that the log files CANNOT fit into memory ?
As a matter of fact, log files (of websites like Amazon) DO generally NOT fit into memory, so why dont we play a bit more with the problem and make it interesting.
Assume that the log files cant fit into memory and then try to solve it. :P
Dont sermon me PLZ :D
Build a hashmap with key as customer id and value as pages being visited by customer.
1. Initialize the map with pages visited by customer as on day1.
2. looping thru next days, for each customer, check if page visited is not already there in list and old list is not empty, print that customer id.
Build a HashMap with customer_id as key and page_id as value.
Build a HashSet for storing customer_ids.
Loop through log files:
Now if new entry is not in HashMap, add it.
else if present in HashMap, check if page_id is same as current.
If same, do nothing, if different add it to result HashSet.
Build a HashMap with customer_id as key and page_id as value.
Build a HashSet for storing customer_ids.
Loop through log files:
Now if new entry is not in HashMap, add it.
else if present in HashMap, check if page_id is same as current.
If same, do nothing, if different add it to result HashSet.
This is too simple a question..wonder why they asked it?
- Lord_of_the_Rings June 07, 2009