I had a weird interviewing.io interview. Inspite of doing well(me thinks so), I wasnt given the headsup. This is how it went. 1) Was asked to code substr(haystack, needle) and this is the code i wrote in 8 minutes to write and test: def substr(haystack, needle): if len(needle) > len(haystack): return [] res = [] for i in range(len(haystack)-len(needle)+1): count = 0 for j in range(len(needle)): if haystack[i+j] != needle[j]: break else: count += 1 if count == len(needle): res.append(i) return res He pointed to me that I missed handling the "" string and None and "non-string" types as inputs. I told him that empty string should be handled, but pointed out the following: a) Usually in an interview, we dont check for null inputs, because, its always a oneline to handle it at the start of the code and in an interview, its not expected. b) I have never seen stuff being tested like, for a string input, is the given value is actually a string or not. Becasue this means, for every program i write: lets say a program that takes a list of numbers as input and a target number and does a binary search, My first line will be like if not all(isinstance(x, int) for x in arr) or not isinstance(target, int): return -1 I dont think this is expected in any interview and the interviewer was a bit too strict (may be crazy strict) to expect sometthing like this. He inisisted I handle all the cases, including wrong type as input and I did. His next question was to optimize the solution. I told him about KMP and explained the algorithm, but he wanted constant space. So i suggested Rabin Karp. And he wanted me to explain it and i explained. Then he wanted me to type in the editor the actual formula i would use to create hashes for the haystack = "aaab" and needles's lenght = 3. I wrote the detailed formulas and calculated the hashes for aaa and the rolling hash based on that for aab. It was exactly 30 minutes since the start of the interview, and he mentioned we have 3 minutes more and lets see how far you can go with the implementation. I told him, i cant do anything in 3 minutes, and asked him if this isn't a 45 minute or 1 hour interview. He said lets see your progress in 3 minutes. I decided to implement the rolling hash function (dint have the time to test it) and this is what i came up with in like 2 minutes: def calc_next_hash(phash, inp, i, size): phash -= inp[i-1] * (256 ** (size-1)) phash = phash * 256 phash += ord(inp[i+size-1]) return phash Then he ended the interview by giving 5 more minutes to ask questions. I made it a point to tell him that it was very really absurd, to do type checks for parameters in an interview. He said lets choose to disagree on this one and the interview ended. After the interview I was left a bit disappointed, should I be worried about interviewers like this one ?
He gave me the same needle in the haystack question lol
Well, based on what you described most likely he did not like your attitude and communication skills. I met inflexible people at work many times who are also super opinionated. It is always unpleasant to work with them (even in cases when they are right). You may not be such a person but you sure look like one of them based on your story.
Idk if your intent is just to give him constructive feedback on his interview but it sounds like you're being a dick. When someone asks you to handle null, it's an opportunity to discuss method design and talk about why public API methods need it but maybe not private ones. It's an opportunity to discuss throwing exceptions vs returning something. Or I guess an opportunity to sound overly sensitive about your code (huge red flag)
Null is fine. How about handling different input types? Will your first line of binary search code be an instance type check in an interview ?
TBH I don't interview in Python or JS so I never worry about type checking, but I think I'd rather discuss pros and cons then just do whatever the interviewer wants. One of the most common complaints about engineers is that they are too uncompromising in code review discussions. Imagine you two are co-workers and he gives you this feedback in a code review. You want to be very tactful and easy to work with if the difference is immaterial.
Also I don't think you should spend half of the interview coding a brute force solution then say "I can't finish that" when asked to code the faster one. You will be compared to candidates that had at least some working code for a fast solution. Get as far as you can. Also if you're aware that a solution is suboptimal consider not coding it at all (just describe and move on unless interviewer wants you to code that)
Well i spent 8 minutes coding and testing the brute force and he insisted on coding that first. Also the remaining time was spent on detailed explanation of KMP and Rabin karp using examples. Then he said 3 minutes left. It was a 30 minute interval in total.
And if you what Rabin karp is, you will be able to understand that calculating next hash is the core of the algorithm that i coded in a couple of minutes.
Don’t be so entitled, it was free practice, what did you expect? Go use pramp if you don’t like it
Well you may have sucked it up all your life. 🤣.. but that's not how everyone behaves...
Tech Industry
Yesterday
712
Tried FSD for long drive 3000 miles. Its fuking awesome.
Tech Industry
12h
3203
Goog Employees Arrested
2024 Presidential Election
10h
880
If you vote for Biden this year, don't complain about layoffs
Tech Industry
14h
1129
TC progression. Estimated to hit $1M+ this year. AMA
Cars
Yesterday
1274
Seattle people, what cars do you have? 🙂
Was the interviewer's name Effulgent Slide Rule?
yes, yes, yes.
There are asshole interviewers like him everywhere. But most interviewers are good. Don't worry. You'll real interviews should be better.