Link to home
Start Free TrialLog in
Avatar of bachra04
bachra04Flag for Canada

asked on

White board coding practice

Hi experts ,

I am scheduled for on site interview with one of the big US Tech companies in two weeks , I will have at least 2 to 3 coding problems to solve on white board.
When I did the phone interview, I did notice that I was struggling to come up with a clean implementation ( usually my code had one or two logical bugs) . And the main reason is that even though I know more less the solution (went through similar problem during my preparation) I don't remember exactly how the algorithm was written. One approach that I am thinking about is to start memorizing most of the algorithms that I have seen during my preparation :
1- I am not sure that's a good approach or not ?
2- I am not sure how to do that, i.e. is there a method or trick that you guys use to memorize an algorithm ? I can think about re-writing every algo twice from scratch. But I am not sure that at the interview day, I will be able to remember all the details of every algorithm.
3- finally what advises can you give to me to improve my white board coding skill ? ( of course other than blindly practicing)

Thanks
ASKER CERTIFIED SOLUTION
Avatar of phoffric
phoffric

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bachra04

ASKER

Hi Phoffric,

This is a very good advise, I will try to to follow it. But this basically covers the part until you find the optimal solution. But what about the implementation part ?
I feel I need to practice more to get good at my algorithm techniques, since in my daily work usually I don't have to write any complex algorithm. I thought memorizing 20 or 30 more complex algorithms will help me get faster in coding the solution.

Thanks
Avatar of phoffric
phoffric

If you have the ability to memorize the implementation of many algorithms, then why not do that? Parts of what you have memorized could likely carry over to a different problem.

>> usually my code had one or two logical bugs
Making errors on the fly is normal. And just as you do on the job, you check your work with some scenarios and see if your logic is correct, and then fix it if is not. The algorithm may work generally, but there are corner cases that you should try to use in checking out your code.

Before beginning a coding exercise, state/write your assumptions for them to see, such as whether you can assume that the inputs are valid or whether they want you to verify the inputs. If the latter, to speed things up, you could just add a comment to check the inputs and give the cases to check as comments.

FWIW, I did not come up with the optimal solution for that interview question I gave you. But immediately after the interview, I recognized some points and I emailed them detailed pseudo code with complexity comments, and I was offered the position.