Search

7 actionable steps to ace your coding interview πŸ‘©β€πŸ’»


Coming out happy from an Interview | credits : workable

It's the big day today. You're prepped up for the interview. You are already off to a great start with a killer intro and nailed all the questions about your resume. Now it's the time for big boy, the programming problem. Here we share 7 tips to help you ace it too!


For this article, πŸ§” = The Interviewer and πŸ‘©β€πŸ’» = You


Let's assume your programming round starts with . .


πŸ§” : " Write a function to convert a string to number "


Step 1. Clarify the Hidden Details

Make sure you fully understand the question before diving in. Sometimes interviewer EXPECTS you to clarify vague conditions and state assumptions, to test your clarity of topic


πŸ‘©β€πŸ’» : " Does this function handle whole numbers or decimals? "


πŸ‘©β€πŸ’» : " Also, Can I assume the input to be a valid number? not -00002 or 2.3.1 "


πŸ§” : < Answers your queries (impressed by your critical thinking) >


Step 2. Write edge cases

Once the question is crystal clear in your mind, start with writing some sample cases.

If needed, draw a sample input using diagram of the data structure you'll be using (especially if it's trees / graphs). Think about what some edge cases might be.


πŸ‘©β€πŸ’»: "I'll write some test cases for reference: '-1', '2.0', '2147483647', '-2147483647' "


Step 3. Simulate approach on Paper & Discuss

πŸ‘©β€πŸ’» : " I'll take a minute to formulate an approach on paper "


πŸ§” : " Sure "


Remember to start simple, and speak your mind frequently


πŸ‘©β€πŸ’» : [ After 2 mins ] " I have this <brute force> solution on top of my mind, which should give us the correct answer. I'll now try to improve my solution further. "


πŸ§” : < Likes the small, frequent communication >


Once you achieve the optimal solution, mention the time + space complexity without fail!


πŸ‘©β€πŸ’» : " I came up with < optimal solution > of time and space complexity of O(n) "


πŸ‘©β€πŸ’» : < Walks through the solution by hand, communicating all the steps clearly, with an example input >


πŸ§” : " I feel this is a fairly good solution approach. Let's code this in "


4.Comment to explain your code

This saves some work for the interviewer, and also makes your code look clean!


5. Write modular, intuitive code

  • Add helper functions to reduce clutter

  • Use intuitive variable names : temp❌ ans❌ stringIndexβœ… [Have a look at the pictureπŸ‘†]


Step 6. Test your code for bugs 🐞

So this is it then? Well. . . . Not yet.


Professional Software Developers consider it an essential practice to test the code extensively. If time permits, try running your code on some sample edge cases you made in step 2.


πŸ‘©β€πŸ’» : " I'll go ahead and write a main function to test some cases, if time permits"


πŸ§” : < Doubly assured of your professionalism >


[Bonus] 7. If you’re stuck : Stay calm, Think out loud, and Try new ideas


It is not unpopular in an interview that the problem absolutely stuns you. In such situations, keep calm, hold up your fighting spirits and follow these tips:

  • Try to go through a mental checklist of Data Structures and Algorithms you have in your inventory, and check if something fits.

  • Think out loud . Doing this will help interviewer gauge your direction, after which he can give you a suitable hint.

  • Strike a balance between thinking and communicating. Communicating too frequently will not give you time enough to think with a stable mind. Communicate too less, and you could end up spending too much time on a wrong approach which otherwise the interviewer could have corrected.

  • Interviewers sometimes give you brownie points for struggling with the problem and not giving up



[Bonus 2] A sample coding interview by Google




This was a guide to ace your coding round in an interview. But this is just one part of the interview process. There might still be a ton of confusions in your mind:

  • How to introduce yourself impactfully?

  • How to draft a resume that's eye-catching and passes ATS?

  • How to apply and ace off-campus hiring cycle process?

All these are skills which can be mastered with efforts and guidance. Follow EdMad to keep in touch, and we'll help you with your interview prep journey right till your dream job!

9 views