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