Interview Question for Software Engineer / Developers






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

Create a Hashtable. Its key should be the character encountered in the string.
Now start traversing the string. For each character, if its entry exists in the hashtable, increment its count. Else create a new entry for this character in hashtable with its count set to 1.

- Anonymous June 29, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

well you really just need an array since characters are consecutive, the value or a mapping of the value serves as index

- Anonymous June 30, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

need understand the difference between array and hashtable .

your solution is actually an array of 26 element , you don't have to use hash function since what you want to do is to map your character to index.

- Charles January 01, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

but the question stresses on improving time complexity and not space complexity, no?

- Roxanne January 02, 2014 | Flag


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