3 ms·
For the interviewer 1 question of sorting an array with only two unique elements. Am I missing something? The solution just requires counting lower value and wr
by aub3bhat 9y ago
For the interviewer 1 question of sorting an array with only two unique elements. Am I missing something? The solution just requires counting lower value and writing it number of times it occurs and then writing the other value until the end.
https://en.m.wikipedia.org/wiki/Counting_sort https://en.m.wikipedia.org/wiki/Counting_sort
- IncRnd 9y agoFor some reason many senior engineers cannot answer questions of this type. These types of questions are meant to see if someone can write programs in language X. They are also followed up with exploratory 'what if' questions that enable the interviewer to inspect the thought processes of the candidate. They are also used in behavioral interviews.
- aub3bhat 9y agoThe person interviewed isn't senior. The one interviewing is. I think her solution for array larger than memory is very inefficient. Even in smaller case one might achieve speed up by excluding unnecessary read/temp/move in else clause by just by writing two values which will likely be in registers.
- IncRnd 9y agoThank you. My comment was not about the candidates but was an explanation for why these types of questions are asked by interviewers.