Coding for Interviews

Coding Live

Free interview prep in your inbox weekly

Complete this weeks interview question

This is a game of taboodont use any associative arrays (dictionaries, hash.*s, s, PHP array(k=v)s etc) in your implementation. Time yourself, and time box your attempt to one hour. As Yegge notes: You should be able to implement one using only arrays in your favorite language, in about the space of one interview.

CheckIO- Use python programming to beat a game

Ive been working on putting a site together to store all the past weeks questions, CS cheat sheets, pre-interview checklists and the reading list Ive been generating. If you have friends that want to sign up, you can send them toCoding for Interviews.

Steve Yegges five essential phone screen questions

For this week, take a stab atimplementing a hash tablein your favorite programming language. That is to say, write a data structure that will let you map keys to values and give you amortized constant-time access. Your implementation should have some form of collision handling–what do you do when your hash function maps two keys to the same place?

Dont confuse your terms. This sentence should make sense: to build an unsorted

Sucking at something is the first step to becoming sorta good at something.

Nobody goes into a boxing match cold. Lesson: you should bring your boxing gloves to the interview. No, wait, sorry, I mean: warm up beforehand! Steve Yegge,Get that Job at Google

Reddit Daily Programmer- THREE programming exercises per day.

As Dan Blumenthal, Director of Engineering at TripAdvisor noted in his excellent articleHow to Prepare for Technical Interviews:

Here are some steps you should take toward gaining a deep understanding of hash tables:

To understand the nuances and recent advances in hash table optimization, read through theWikipedia article on hash tables. Learn a bit aboutwhat makes for a good hash keyas well.

Nobody goes into a boxing match cold. Lesson: you should bring your boxing gloves to the interview. No, wait, sorry, I mean: warm up beforehand!

Sucking at something is the first step to becoming sorta good at something. – Jake, Adventure Time

This weeks programming interview related links:

Probably not. But I review a basic CS concept and point to useful learning resources every single week. Become an excellent programmer over time.

Theres a lot of angles to continue learning about hash tables from. Try to gain an understanding of at least three different strategies for resolving collisions and for generating hash keys.

Send me any programming interview related links you find this week and Ill compile them for the next issue.

A special note on Hash Tables […] Interviewers love these.Know how they work intimately and know the difference between Maps and Sets. You can frequently get from O(n2) or O(n*ln(n)) down to O(n) by using a Hash Table or Set, and understanding the tradeoffs (e.g., more memory vs. more time) can start an interesting conversation that will impress your interviewer.

Hashtables are arguably the single most important data structure known to mankind. You absolutely have to know how they work. Again, its like one chapter in one data structures book,so just go read about them.

Make a note if youre looking for jobs and would like to include your email and location with your solution so others can send you job tips.

for your next job (be it 2 or 5 years down the road) by reviewing problems regularly.

Reply with your solutions (photos of paper or whiteboards get bonus points) and you may be featured in next weeks email. If you typed your solution out, you can post your code as agistand reply with the link.

You will be the first to get accounts and access to the bonus material.

After my college CS courses, I thought I understood hash tables well enough to get by in my interviews. Heck, I used them all the time! But it took a bit more work to feel I had a grasp of the tradeoffs and functionality. I was asked about their details inhalfof my interviews.

Read the explanations of hash tables onthis StackOverflow post. No one explanation will give you a full understanding, but if you work through all of the 1+ point answers youll have most of the nuances down. If you have time, work through this post aboutimplementing table lookup in C++. If youre having trouble understanding these posts, start with this simple SparkNotesexplanation of hash tables and collisions.

Could you describe how a hash table works? How to choose a good hash function? How to handle collisions, and when to resize the table?

Practicing many problems gives you confidence. Theres a reason your last interview is the easiest.

Were having so much fun this week with hash tables already, why stop!

As an exercise, reply to me with your best explanation of hash tables and any other resources you found helpful in understanding them. Ill post the best ones next week for those who still havent fully grasped it yet.

is used to place items at memory locations in an

Leave a Reply