An alternative to HackerRank et. al. That Seems a Distinct Improvement
I’ve been interviewing for jobs, and all too often these days the company uses one of the not-at-all-like-the-job tests that I complained about in another article.
But twice this past week I received invitations to take tests from another company Hirevue, that I hadn’t heard of before. It solves some of the problems I mentioned on the other ones:
- No countdown timer. One recruiter teed up the test “should take about 45 minutes” but this wasn’t enforced in any way.
- A programming editor, but no restriction on using other resources (websites, editors, what have you.)
- You do have to give video responses to some questions; it’s apparently configurable whether you can retry your submission. I’ve seen it both ways, and I’m getting used to doing this so it’s not as off-putting as I have let it be in the past.
So with all this: I think I passed one of these last week, without even Googling for the algorithm, amazingly enough.
- write a program that determines whether two strings as input are anagrams; report the time complexity of your solution
I did Google ‘anagram’ just to double-check I knew what that was: two words who share the same letters in a different sequence. So:
- way and yaw are anagrams
- way and bay are not
The algorithm came to me with just a moment’s thought:
- create a dictionary / hash table of the letters in the first word, with value increased by 1 for every duplicate letter
- go through the second word and reduce the dictionary value by 1 every letter you hit, or fail if you come to a letter that’s not already in the dictionary
- the dictionary values should all be back to 0 at the end; if so return TRUE
Best of all, I was able to test this code using the standard tools I always use: Emacs and Python 3.
I haven’t heard yet about this job, but if companies get the message and use this one instead of HackerRank and such, then there’s hope!
Best of luck in your job search …