SumoLogic Interview Question for Software Engineer in Tests


Country: India
Interview Type: Phone Interview




Comment hidden because of low score. Click to expand.
0
of 0 vote

Hash Table is the optimal in this case. So simple and quick.

- Rolando August 05, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Huh. Just saying Hash Table won't do. How would you implement getRandom() in O(1)?

- Anonymous August 09, 2014 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

When you say everything is preferably O(1), are you just saying that faster is better? Clearly "contains" can't be O(1) unless its probabilistic (or unless the data structure is defined to contain at -most O(1) elements...)

- ZSGoldberg August 09, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Yes, typically people forget hashtable are only expected O(1). But, being a pain in the ass pedant about it is not going to get you the job. (Comment not aimed at you ZSG, just a general comment).

The assumption is you have a great hash function (like a perfect hash function).

Carry on.

- Anonymous August 09, 2014 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

The answer is a LinkedHashMap which maintains the order in which elements are inserted. Regarding Random is easy : Generate a random number between 0 and Size and do a get(randomnumber)

- Abhi March 23, 2015 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More