Code Samples

I've done thousands of interviews, most of them at Microsoft. You'd think eventually I'd memorize the answers to the questions. Unfortunately my brain doesn't work that way. I learn from doing and referencing. This is where I'll build up my collection of cool code that I've failed to write on the whiteboard, only to come home and figure it out.

I'll add more here as time permits, but I'm usually busy either ruling the universe or chasing the voices in my head so updates to the site are slow coming. P.S. for the literal: No, I don't hear voices.

Justify String - Insert spaces to make a string of words fit a specific width.

Palindrome - Determine if a string represents a palindrome.

Find a String in a Stream - Code to locate a given string within a stream.

Pancake Sort - Cool little sort utility. Imagine sorting a stack of pancakes using only a spatula.

Permutations of a String - A method to show all the permutations of a string.

Reverse a String - This implementation reverses a string or all of the words in a string.

Remove Whitespace From A String - The "don't try and mix pseudocode from 2 different languages in an interview" sample.

Find the nth Fibonacci Number - Located in a cave near Redmond, WA.

Make Change - This one really kicked my butt. Returns the different combinations possible when making change.

Output array values in a spiral - This one's not done yet, but figured I'd put it up anyway. Working on a faster version with less code.

Find all of the integers that occur in both arrays of integers. - Wow. All the discussions online said that the hashtable method was faster for large arrays. I found that's wrong. Unless my implementation stinks. If so, let me know!

GOOD NEWS!

My most recent contract is officially coming to an end so I'm back on the market!

This normally lasts for only 1 or 2 interviews, so if you want me, better move fast!

Use the Contact page to get me on your team!