4 Hacks for Finding the Optimal Answer in Coding Interview QUICKLY!

CS Dojo · Beginner ·⚡ Algorithms & Data Structures ·10y ago

Key Takeaways

The video demonstrates 4 hacks for finding the optimal answer in coding interviews, including thinking out loud, using examples, and asking for feedback. It uses the maximum subarray problem as an example to illustrate these techniques.

Full Transcript

have you ever been flustered in the coding interview maybe it was because you weren't able to find the right data structures or algorithms to use in the problem quickly in this video I'm going to show you how to find the optimal answer in the coding interview quickly just as an example let's consider this maximum subarray problem now what's a subarray a subarray is basically an array within an array so an example of a subarray would be 21 or could be just one element3 or it could be the whole array that's also a subarray but if we had instead -3 and let's say one that's not a subarray because these are not contigous elements so a subarray is a set of continuous elements within the given array now the problem here is finding the subarray with the maximum sum here's what I mean if we look at this subarray 2 one the sum is 2 + 1 = 3 and if you look at this subarray with just3 the sum is3 and we are trying to find the one with the maximum sum and in this example it's actually 21 with the sum three and you can check it yourself too and let's say you're given this problem in your interview and you don't know how to solve it and you can't figure out the solution right away what should you do about it there are four tips I want to give you here for finding the right solution very quickly tip number four is just say can I think for a second whenever you start thinking you know most candidates become completely silent when they start thinking and it could be really awkward for the interviewer because they don't know what you're doing so you should really clarify whenever you start thinking tip number three is think out loud once you say that phrase canot think for a second you should start thinking out loud instead of silently I know for some people it's easier to think silently but you don't have to overdo this you just need to let the interviewer know where you are in your thought process and the way I would do it might be something like this I would say okay I noticed that there are positive numbers here in this example and also negative numbers and if we only had positive numbers let's say one two 1 then the problem would be much easier because then the maximum sub array would just be the whole array so what makes it hard is the fact that we have negative numbers so maybe we can do something separate to the negative numbers and the positive numbers in the array and when you say something like that the interviewer is going to say either okay you're going in the right direction or in the wrong direction and that's going to be really helpful for figuring out what the right solution is so you shouldn't think of the interview as a monologue or a solo problem solving session you should think of it as more of a collaborative thing as a conversation so you shouldn't have to solve everything by yourself when the average candidate is given a problem they just start writing code but you shouldn't do that you should first think through examples and think of a few more examples than uh that just given one so in this problem I might say okay this is a of course a Give an example but I can think of a few more examples what about all positive numbers and what about maybe all negative numbers and when you start thinking through examples you'll be able to think in a much more concrete way than trying to think of everything in an abstract way let's say you start thinking through examples and you come up with a solution then uh you should ask does this seem like a good strategy unless you're 100% sure that your solution is optimal and the way I would do it in this example might be something like this I would say okay my solution would be compare all the sub uh all the possible subarrays so the ones starting at the first index and then the ones uh starting at the second index and I'll compute the sum for each subarray and I'll just pick the one with the maximum sum so it's a Brute Force strategy and then I would ask to the interviewer does this seem like a good strategy when you say that you're essentially giving some space to the interviewer so they can give you feedback as to if you're going in the wrong direction or if your solution is really optimal and this way you don't have to waste time writing code because you didn't write code in the first place you don't have to waste time writing code for a solution that doesn't work or that's not optimal so just to recap say can I think for a second when you start thinking think out loud instead of silently you don't have to overdo this you just need to let the interview know where you're thinking from time to time and don't start writing code right away use examples first and finally when you come up with a solution just ask does it seem like a good strategy and these are my four tips for finding the optimal solution in a coding interview quickly I hope you like the video if you want to watch more videos like this you can click right here to subscribe to my channel and see you soon

Original Description

*Just getting started with coding interviews? Check out my "Get Ready for Your Coding Interview" course on Lynda.com: https://www.lynda.com/Software-Development-tutorials/How-Ace-Developer-Interview/576698-2.html?lpk35=9181&utm_medium=ldc-partner&utm_source=CMPRC&utm_content=524&utm_campaign=CD20605&bid=524&aid=CD20605 (You'll get a 30-day trial with the link)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from CS Dojo · CS Dojo · 1 of 60

← Previous Next →
4 Hacks for Finding the Optimal Answer in Coding Interview QUICKLY!
4 Hacks for Finding the Optimal Answer in Coding Interview QUICKLY!
CS Dojo
2 Dynamic Programming Tutorial with Fibonacci Sequence
Dynamic Programming Tutorial with Fibonacci Sequence
CS Dojo
3 Kadane's Algorithm to Maximum Sum Subarray Problem
Kadane's Algorithm to Maximum Sum Subarray Problem
CS Dojo
4 Longest Common Subsequence (Dynamic Programming)
Longest Common Subsequence (Dynamic Programming)
CS Dojo
5 0-1 Knapsack Problem (Dynamic Programming)
0-1 Knapsack Problem (Dynamic Programming)
CS Dojo
6 Amazon Coding Interview: Count Negative Integers in Row/Column-Wise Sorted Matrix
Amazon Coding Interview: Count Negative Integers in Row/Column-Wise Sorted Matrix
CS Dojo
7 Microsoft Coding Interview Question and Answer: Lowest Common Ancestor
Microsoft Coding Interview Question and Answer: Lowest Common Ancestor
CS Dojo
8 Learn Counting Sort Algorithm in LESS THAN 6 MINUTES!
Learn Counting Sort Algorithm in LESS THAN 6 MINUTES!
CS Dojo
9 Radix Sort Algorithm Introduction in 5 Minutes
Radix Sort Algorithm Introduction in 5 Minutes
CS Dojo
10 Coding Interview Question and Answer: Longest Consecutive Characters
Coding Interview Question and Answer: Longest Consecutive Characters
CS Dojo
11 Coding Interview: Can You RANDOMLY Reorder Array in O(N)?
Coding Interview: Can You RANDOMLY Reorder Array in O(N)?
CS Dojo
12 Coding Interview Question: Tower Hopper Problem
Coding Interview Question: Tower Hopper Problem
CS Dojo
13 Problem Solving Technique #1 for Coding Interviews with Google, Amazon, Microsoft, Facebook, etc.
Problem Solving Technique #1 for Coding Interviews with Google, Amazon, Microsoft, Facebook, etc.
CS Dojo
14 Google Coding Interview Question and Answer #1: First Recurring Character
Google Coding Interview Question and Answer #1: First Recurring Character
CS Dojo
15 Facebook Coding Interview Question and Answer #1: All Subsets of a Set
Facebook Coding Interview Question and Answer #1: All Subsets of a Set
CS Dojo
16 Think you're not smart enough to work at Google? Well, think again.
Think you're not smart enough to work at Google? Well, think again.
CS Dojo
17 How to Crack a Google Coding Interview - An Ex-Googler’s Guide
How to Crack a Google Coding Interview - An Ex-Googler’s Guide
CS Dojo
18 Amazon Coding Interview Question - K Closest Points to the Origin
Amazon Coding Interview Question - K Closest Points to the Origin
CS Dojo
19 How I Got an Internship at Microsoft
How I Got an Internship at Microsoft
CS Dojo
20 How I Got a Job at Google as a Software Engineer (without a Computer Science Degree!)
How I Got a Job at Google as a Software Engineer (without a Computer Science Degree!)
CS Dojo
21 Why I Left My $100,000+ Job at Google
Why I Left My $100,000+ Job at Google
CS Dojo
22 Top 5 Programming Languages to Learn to Get a Job at Google, Facebook, Microsoft, etc.
Top 5 Programming Languages to Learn to Get a Job at Google, Facebook, Microsoft, etc.
CS Dojo
23 How I Learned to Code - and Got a Job at Google!
How I Learned to Code - and Got a Job at Google!
CS Dojo
24 Why I Left Google To Be A YouTuber FULL-TIME (and NOT part-time!)
Why I Left Google To Be A YouTuber FULL-TIME (and NOT part-time!)
CS Dojo
25 What Is Dynamic Programming and How To Use It
What Is Dynamic Programming and How To Use It
CS Dojo
26 Python Tutorial for Absolute Beginners #1 - What Are Variables?
Python Tutorial for Absolute Beginners #1 - What Are Variables?
CS Dojo
27 What's It Really Like To Intern At Google? (LIVE with a former Google software engineer intern)
What's It Really Like To Intern At Google? (LIVE with a former Google software engineer intern)
CS Dojo
28 How to Use If Else Statements in Python (Python Tutorial #2)
How to Use If Else Statements in Python (Python Tutorial #2)
CS Dojo
29 Dynamic Programming Interview Question #1 - Find Sets Of Numbers That Add Up To 16
Dynamic Programming Interview Question #1 - Find Sets Of Numbers That Add Up To 16
CS Dojo
30 How To Use Functions In Python (Python Tutorial #3)
How To Use Functions In Python (Python Tutorial #3)
CS Dojo
31 What’s It Like To Be A Program Manager Intern At Microsoft? (LIVE with a former Microsoft intern)
What’s It Like To Be A Program Manager Intern At Microsoft? (LIVE with a former Microsoft intern)
CS Dojo
32 Introduction To Lists In Python (Python Tutorial #4)
Introduction To Lists In Python (Python Tutorial #4)
CS Dojo
33 Introduction to For Loops in Python (Python Tutorial #5)
Introduction to For Loops in Python (Python Tutorial #5)
CS Dojo
34 What Programming Language Should I Learn First?
What Programming Language Should I Learn First?
CS Dojo
35 What Is Competitive Programming and How To Prepare For It (LIVE with Gaurav Sen)
What Is Competitive Programming and How To Prepare For It (LIVE with Gaurav Sen)
CS Dojo
36 While Loops and The Break Statement in Python (Python Tutorial #6)
While Loops and The Break Statement in Python (Python Tutorial #6)
CS Dojo
37 More About For Loops in Python & Solutions to the Last 2 Problems (Python Tutorial #7)
More About For Loops in Python & Solutions to the Last 2 Problems (Python Tutorial #7)
CS Dojo
38 How to Learn to Code - Best Resources, How to Choose a Project, and more!
How to Learn to Code - Best Resources, How to Choose a Project, and more!
CS Dojo
39 How To Use Dictionaries In Python (Python Tutorial #8)
How To Use Dictionaries In Python (Python Tutorial #8)
CS Dojo
40 Data Structures & Algorithms #1 - What Are Data Structures?
Data Structures & Algorithms #1 - What Are Data Structures?
CS Dojo
41 An Overview of Arrays and Memory (Data Structures & Algorithms #2)
An Overview of Arrays and Memory (Data Structures & Algorithms #2)
CS Dojo
42 Introduction to Classes and Objects - Part 1 (Data Structures & Algorithms #3)
Introduction to Classes and Objects - Part 1 (Data Structures & Algorithms #3)
CS Dojo
43 Classes and Objects with Python - Part 1 (Python Tutorial #9)
Classes and Objects with Python - Part 1 (Python Tutorial #9)
CS Dojo
44 Introduction to Classes and Objects - Part 2 (Data Structures & Algorithms #4)
Introduction to Classes and Objects - Part 2 (Data Structures & Algorithms #4)
CS Dojo
45 Classes and Objects with Python - Part 2 (Python Tutorial #10)
Classes and Objects with Python - Part 2 (Python Tutorial #10)
CS Dojo
46 Introduction to Linked Lists (Data Structures & Algorithms #5)
Introduction to Linked Lists (Data Structures & Algorithms #5)
CS Dojo
47 Introduction to Recursion (Data Structures & Algorithms #6)
Introduction to Recursion (Data Structures & Algorithms #6)
CS Dojo
48 Introduction to Big O Notation and Time Complexity (Data Structures & Algorithms #7)
Introduction to Big O Notation and Time Complexity (Data Structures & Algorithms #7)
CS Dojo
49 Amazon Coding Interview Question - Recursive Staircase Problem
Amazon Coding Interview Question - Recursive Staircase Problem
CS Dojo
50 Using Boolean in Python (Python Tutorial #11)
Using Boolean in Python (Python Tutorial #11)
CS Dojo
51 Intro to Data Analysis / Visualization with Python, Matplotlib and Pandas | Matplotlib Tutorial
Intro to Data Analysis / Visualization with Python, Matplotlib and Pandas | Matplotlib Tutorial
CS Dojo
52 What Can You Do with Python? - The 3 Main Applications
What Can You Do with Python? - The 3 Main Applications
CS Dojo
53 Facebook Coding Interview Question - How Many Ways to Decode This Message?
Facebook Coding Interview Question - How Many Ways to Decode This Message?
CS Dojo
54 List Comprehension Basics with Python (Python Tutorial #12)
List Comprehension Basics with Python (Python Tutorial #12)
CS Dojo
55 How To Use Sets in Python (Python Tutorial #13)
How To Use Sets in Python (Python Tutorial #13)
CS Dojo
56 Python books for beginners? What Python projects to work on? | 2 Python Beginner FAQ’s!
Python books for beginners? What Python projects to work on? | 2 Python Beginner FAQ’s!
CS Dojo
57 Resources for Learning Data Structures and Algorithms (Data Structures & Algorithms #8)
Resources for Learning Data Structures and Algorithms (Data Structures & Algorithms #8)
CS Dojo
58 6 Python Exercise Problems for Beginners - from CodingBat (Python Tutorial #14)
6 Python Exercise Problems for Beginners - from CodingBat (Python Tutorial #14)
CS Dojo
59 Google Coding Interview - Universal Value Tree Problem
Google Coding Interview - Universal Value Tree Problem
CS Dojo
60 Best laptops for programming? How to get a job at Google? - And other FAQ’s!
Best laptops for programming? How to get a job at Google? - And other FAQ’s!
CS Dojo

The video teaches 4 hacks for finding the optimal answer in coding interviews, including thinking out loud, using examples, and asking for feedback. It provides a step-by-step approach to solving algorithmic problems and emphasizes the importance of communication skills in interviews. By following these techniques, viewers can improve their problem-solving skills and increase their chances of success in coding interviews.

Key Takeaways
  1. Say 'can I think for a second' when starting to think
  2. Think out loud instead of silently
  3. Use examples to think through problems
  4. Ask 'does this seem like a good strategy' to get feedback
💡 Thinking out loud and using examples can help interviewers understand the thought process and provide valuable feedback.

Related Reads

📰
Common Methods to Find GCD
Learn 3 simple methods to find the Greatest Common Divisor (GCD) and improve your programming skills
Medium · Programming
📰
Recursion vs Iteration: Choosing Your Path Like Neo in *The Matrix*
Learn when to use recursion vs iteration in coding, and how to choose the best approach for your problem, just like Neo choosing his path in The Matrix
Dev.to · Timevolt
📰
You Don’t Need to Solve 500 LeetCode Problems. You Need to Recognize 12 Patterns.
Recognize 12 common patterns to improve coding skills, rather than solving a large number of LeetCode problems
Medium · Programming
📰
Google Interview Question #2
Learn to solve a Google interview question about finding the minimum initial energy required to cross a river with varying wind speeds
Medium · JavaScript
Up next
Webhooks & Callbacks For Beginners in Python
NeuralNine
Watch →