How to standout in a DSA Interview ? | Important tips to crack DSA Assessment Rounds | @SCALER
Summary
TLDRIn this informative session, Harid Gupta from Soft Engineered discusses the best practices for tackling Data Structures and Algorithms (DSA) interviews. He emphasizes the importance of understanding the problem, starting with brute force solutions, and then optimizing them. Gupta highlights the need for clear communication of your approach, clean and understandable code, and thorough testing. Tips for preparation include practicing on a text editor, mock interviews, and being receptive to interviewer hints. The session aims to equip viewers with strategies to excel in DSA interviews.
Takeaways
- 📚 Importance of DSA: DSA rounds are crucial in the hiring process to test candidates' coding and problem-solving skills.
- 🧐 Preparation Beyond Coding: Solving many problems helps clear online assessments, but more is needed for in-person interviews.
- 🔍 Clarification First: Always clarify the problem and assumptions before diving into a solution to avoid misunderstandings.
- 🔄 Start with Brute Force: If an optimal solution is not immediately clear, start with a brute force approach to demonstrate a base understanding.
- 💡 Think Out Loud: Share your thought process with the interviewer to keep them engaged and understand your approach.
- ⏱ Time Complexity: Always consider and state the time and space complexity of your solutions to show awareness of efficiency.
- 🔄 Optimize: Be open to hints from the interviewer and optimize your solution based on feedback to show adaptability.
- 💻 Code Quality: Write clean, readable code with meaningful variable names and comments to demonstrate good coding practices.
- 📝 Dry Run: Test your code with examples and edge cases to ensure correctness and demonstrate thoroughness.
- 📈 Practice Mock Interviews: Use mock interviews to practice explaining your approach and receiving feedback for improvement.
- 🔑 Communication: Maintain open communication with the interviewer to understand their expectations and adjust your approach accordingly.
Q & A
What is the main topic of the video script?
-The main topic of the video script is discussing the right way to tackle Data Structures and Algorithms (DSA) questions in interviews.
Who is the speaker in the video script?
-The speaker in the video script is Harid Gupta, a mentor of Soft Engineered.
What is the purpose of the SC Master Class mentioned in the script?
-The SC Master Class is designed to help individuals improve their DSA knowledge and skills with the guidance of industry-leading experts.
Why is it important to understand the problem before providing a solution in a DSA interview?
-Understanding the problem is crucial because it helps to avoid misinterpretation, ensures the solution is relevant, and demonstrates the candidate's ability to work with ambiguity.
What is the difference between a DSA online assessment and a DSA interview?
-An online assessment primarily checks if the code is fully optimal, functional, and passes test cases, while a DSA interview also evaluates the candidate's ability to explain their approach and write clean, readable code.
What are the steps suggested for tackling DSA questions in an interview?
-The steps suggested are: 1) Clarification or disambiguation, 2) Brute force or suboptimal solutions, 3) Building an optimal solution, 4) Improving the solution, 5) Coding, and 6) Testing or dry run.
Why is it recommended to think out loud while solving a problem in an interview?
-Thinking out loud allows the interviewers to follow the candidate's thought process, which is as important as the final solution itself.
What should be the time and space complexity of a solution in a DSA interview?
-The solution should aim for optimal time and space complexity, which means minimizing both as much as possible while still solving the problem effectively.
How can one prepare for a DSA interview?
-One can prepare by solving questions in a text editor, practicing explaining their approach, using mock interviews for feedback, and understanding the interviewer's expectations.
What is the importance of variable naming in coding during a DSA interview?
-Meaningful variable names are important as they make the code easier to understand and show the candidate's attention to detail, but they should not be overly descriptive to save time.
Why is it important to test the code with edge cases during the interview?
-Testing with edge cases helps to demonstrate the candidate's thoroughness and ability to handle various scenarios, which is a valuable skill in software engineering.
Outlines
📘 Interview Preparation for DSA Rounds
Harid Gupta, a mentor at Soft Engineered, introduces the video's focus on tackling DSA (Data Structures and Algorithms) interviews effectively. He emphasizes the importance of DSA rounds in the hiring process and distinguishes between online assessments and in-person interviews. Gupta suggests that while solving many problems is beneficial, additional strategies are necessary for interview success. He outlines the unique challenges of in-person interviews, such as explaining your approach and writing clean, understandable code, and the importance of recognizing and improving upon one's solutions during the interview.
🔍 Steps to Ace a DSA Interview
The video script outlines a structured approach to DSA interviews, beginning with clarification of the problem at hand. It advises candidates to take time to understand the question fully and to discuss any assumptions with the interviewer. The script then moves on to suggesting the consideration of brute force solutions as a starting point, with an emphasis on time efficiency. It encourages candidates to think out loud to demonstrate their thought process and to explain their approach clearly, including the time and space complexity of their solutions. The script also highlights the importance of improving solutions based on interviewer feedback and the final steps of coding, which should be quick and include clear comments, and concludes with a brief testing phase to ensure the code's correctness.
👨🏫 Practical Tips and Example for DSA Interview Success
The script provides practical tips for preparing for a DSA interview, recommending that candidates practice on a text editor to mimic the interview setting and to focus on explaining their approach and code. It suggests mock interviews for gaining experience and receiving feedback. An example problem is presented to demonstrate the discussed strategies: finding an element with more than one occurrence in an array. The example walks through clarification questions, a brute force solution, and the development of a more optimal solution using sorting or a frequency map. The script concludes by emphasizing the importance of communication with the interviewer and adapting to their expectations, reminding viewers that an interview is a discussion, not a battle.
Mindmap
Keywords
💡DSC questions
💡DC rounds
💡Soft Engineered
💡DSA
💡Online Assessment (OA)
💡Coding Interview
💡Clarification
💡Brute Force Solution
💡Optimal Solution
💡Pseudo Code
💡Time and Space Complexity
💡Variable Naming
💡Dry Run
💡Mock Interviews
Highlights
Harid Gupta, a mentor at Soft Engineered, discusses the effective approach to tackle DSA questions in interviews.
The importance of DSA rounds in the hiring process and the expectations from candidates in coding interviews.
The difference between DSA online assessments and in-person interviews, emphasizing the need for code readability and explanation.
Clarification or disambiguation as the first step in tackling a DSA interview question.
The strategy to start with a brute force solution and then optimize it in the interview.
The necessity of thinking out loud during the interview to demonstrate the thought process.
The importance of stating time and space complexity of any solution proposed during the interview.
Improving solutions based on hints from the interviewer and demonstrating the ability to optimize.
Coding efficiently during the interview, with tips on commenting and variable naming for clarity.
The significance of a dry run to test the code on given inputs and edge cases.
Preparing for a DSA interview by solving questions in a text editor and practicing explanations.
The value of mock interviews for practice and receiving feedback on interview performance.
An example problem demonstration on finding an element with more than one occurrence in an array.
The process of clarification for the example problem, including handling negative numbers and sorted lists.
Exploring different approaches like sorting, frequency maps, and hash sets for the example problem.
Writing clean and efficient code for the example problem, with emphasis on variable naming and comments.
The final advice on maintaining communication with the interviewer to understand their expectations.
The conclusion summarizing the key points for excelling in DSA interviews and inviting further questions.
Transcripts
I have solved 500 DSC questions I'm
definitely going to crack all the DC
rounds in all the companies
right right well maybe you need
something more hello everyone this is
harid Gupta a mentor of soft engineered
Google today I will be discussing with
you what is the right way to tackle DSA
cions in any interview but before we
talk about that check out SC Master
Class by industry leading experts only
on scalers event page link is in the
description below so today we are going
to discuss how to answer any DSA problem
in an interview efficiently DSA rounds
are one of the most common and most
important rounds in any company's hiring
process DSA round or coding or problem
solving or algorithms round many names
similar expectations these rounds are
meant to test your DC knowledge problem
solving ability but not just that
today we are going to discuss what are
the expectations from a candidate in a
coding interview we will discuss what is
the right way to answer in your coding
round and how to
prepare I know many of you will say that
they know how to prepare just do a lot
of problems and yes that will help you
improve your DSN knowledge and your
coding skills this kind of preparation
will help you clear the OA for the
companies but to perform well in an
in-person interview you'll need a bit
more this is why often we see people who
are very good at coding not doing so
well in the interviews so how DSA OA is
different than DSA interview some
companies first take an online
assessment round for DSA and then an
interview even though both rounds are
similar and the questions that are asked
are mostly similar but the strategy to
excel in these rounds are different the
OA round or online assessment round just
covers whether your code is fully
optimal fully functional and passes the
test cases very rarely it happens that
someone is actually going to look at
your code or actually going to read that
code and check how readability is but in
OA the problem is that there's not much
room for errors but that's not the case
with d interviews even if you're not
very sure about some language construct
you can mention to the interviewer that
I don't remember the exact way this
thing is implemented but you can tell
them how it
works what makes a DSA inter view
slightly difficult or just different
maybe is that you have to explain your
approach and your code it's not just
about having the right approach but also
being able to explain your approach
properly and writing the code that's
clean readable and easily understandable
here we are not running our code on some
test cases so we have to check ourself
if our code is correct if it's covering
all the Hedge cases and it's the most
optimal possible
in many cases the interviewer might not
tell you if your code is covering all
edge cases or if the time and space
complexity can be improve so you have to
demonstrate the skills to realize if
your solution is the most optimal or if
it can be improved much like actual
software engineering
work so how should we tackle CS in a
dcent interview follow these steps so
step one clarification or disambiguation
clarify the question first you have
enough time so you can take a few
minutes to understand the question
properly a lot of times people panic and
just start talking about an approach
without actually understanding the
problem take your time understand the
problem if it's not clear maybe ask the
interview for an example if it's not
already provided in some cases the
question is intentionally left ambiguous
to evaluate the candidate's
understanding of the problem and a part
of expectations is to see if the
candidate is able to work with
ambiguity even if you're assuming
something about the problem it's a good
idea to First discuss with the
interviewer your assumptions and ask if
they have any comment on that step two
brute force or suboptimal Solutions if
you can't think of any optimal solution
right away you can start with a Brute
Force solution but don't waste a lot of
time on that just mention what will be
the Brute Force solution and provide the
reason why you're thinking of doing
something better like the solution you
provided can have a exponential time
complexity you can just mention the
approach by saying that since the time
complexity here is too high I will try
to find a better solution or maybe
optimize this one again time is crucial
here so don't spend a lot of time here
the only reason to do this is to show
the interview that while you're thinking
of a solution you do have one root Force
solution in mind it also demonstrates
that you are not just thinking about
without solving a question but solving
it optimally step three build a solution
the next step is to think of a good
optimal solution this is where your DSA
skills will be needed you can take some
time to think about the solution but a
good idea is to think out loud as the
interviewers are also interested in your
thought process being mute for a long
time will also take away their attention
not what you want in an interview while
thinking of a solution you can use an
example to build your approach and
explain your approach to the interviewer
explaining your approach by running the
steps on an example is a good way to
keep the interview aligned with your
thought process some candidates also
prefer writing algorithm or steps or
pseudo code to explain the solution this
is a personal choice and depending on
time and practice you can do it either
way also always State the time and space
complexity of any solution you're
thinking of right away don't wait for
the interviewer to ask that this shows
that while building a solution you're
keeping the time and space complexity in
mind and trying to build an optimal
solution step four improve your solution
use
hints if the provided solution isn't
most optimal or if there's something
wrong with the approach the interviewer
might hint you towards that just
remember that everything that's coming
out of the interviewer's mouth is useful
it could be a hint on how to optimize
your solution or interviewer might be
nudging you away from a bad approach so
be open to hints and try to make good
use of them a good idea is to only go to
coding when the interviewer is satisfied
if the interviewer hints you that they
are satisfied only then move towards the
coding in cases where the question might
be a little too complicated or
challenging even if you not able to
complete the code the interviewer might
still give you a good rating given that
your approach was correct and you
explained it properly step five coding
now we talk about the favorite part of
the candidates the code I generally keep
around 30 to 40% of the total time for
this part after you have formalized your
approach coding should be quick while
writing code keep talking about what
each part of the code is doing adding
some small comments here and there is a
good idea but don't start writing the
whole documentations as you have limited
time keep the comments short short and
crisp keep your code clean and easily
readable make use of spacing new lines
blocks properly to group and separate
various parts of your code variable
naming is another important thing try to
avoid naming your variables with random
words like x y z although using IG for
Loop variables is fine we all do that
for Meaningful data values it's a good
idea to have some meaningful names that
show what this variable is storing the
names don't need to be too descriptive
though as writing long descriptive names
again and again also takes time also
don't take too much time in variable
name engineering they don't have to be
perfect but just not random step six
testing or dry run as a last step test
your code dry run it on a given inputs
first and try to do it quickly if the
input is input example is not given to
you you can create a small example and
try to run it on that you don't need to
write a lot of details just enough to
demonstrate what you are doing also try
testing your code on edge cases like
empty array negative values zero sorted
array reverse sorted array Etc whatever
might be the case for the problem but
again don't spend too much time on this
part don't dedicate more than a few
minutes to dry run try to do it quickly
and in a way that interviewer also
understands what you're trying to do if
you see any problem fix fix that quickly
in some cases you might not get enough
time to dry run but that's fine too also
don't go towards a dry run if your
interviewer is trying to take you to a
follow-up question or a different
question because going to that follow-up
question or next question is more
important so now let's discuss how to
prepare for a DSA interview you know for
DSA and for coding you can do a lot of
problems and you'll improve your DSA and
coding skills but how to prepare for a
DSA inter view I'll share a few
tips try to solve a few questions on a
text editor first not an ID a text
editor okay try to mimic the interviewer
setting maybe even talk as if you are in
an interview and you're explaining your
code to someone practice explaining your
approach practice writing your approach
and demonstrating as if you are
explaining it to someone before running
test cases in an ID try to First keep
your code in a text editor look at it
yourself and try try to find any
problems or improvements in your code
when you feel that's the best you can do
then go for testing your code in an ID
one of the best ways to practice is
using mock interviews ask someone who
has some experience conducting
interviews to take your mock interview
and then ask for their feedback ask what
would be the rating if this was an
actual interview and what would be the
detailed feedback now we will
demonstrate whatever we learned today
with an example
let us consider this question given an
array find an element that has more than
one occurrence that means we have to
find an element that is
repeated let's first go towards the
clarifying questions the clarifying
questions can here be can we have
negative numbers can we have more than
one number which has a frequency more
than one and if that's the case which
one to return is the list given to a
sorted and if there are no repeated
elements what to do what to return
right after the clarification we'll try
the Brute Force solution The Brute for
solution here will be that for each
element I'll check all the elements in
the array and I'll find the same value
with a different index if there's any
such case I'll just return that number
the time complexity for this solution is
order of n Square because for each
number I'm checking the whole array
space complexity although will be order
of fun because I'm not using any extra
space here I know the solution is is
most optimal as the time complexity is
quadratic and I feel we can do better
than
that then we will build a solution I
think we can sort the list and check if
any two adjacent numbers are the same if
that's true we say that element is
repeated the time complexity for this
algorithm will be order of n login as
sorting algorithms take order of n login
time plus order of end time for AR
traversal so overall time complexity
will be order of n log n space
complexity here will be order of fun
because we are not using any extra space
another approach is frequency map what
we can do is for each number we can we
can maintain a frequency map and for
each number we can maintain a count of
how many times this number appears in
the array if we find any number which
has a frequency more than one we can
return that number or we can also
maintain a set of numbers we have seen
so far and if we encounter a number that
we have already seen which is done that
right we can use a hash set or a hashmap
here for quick checking so the time
complexity here will be order of n since
checking in a hash map or a hash set
takes order of one time space complexity
here will be order of n because we might
need to store all the numbers we can
also mention the space time tradeoff
then we can write the code which will be
straightforward here after we have
clarified the approach so this is the
code in the end one important thing to
note is that every interviewer is
different while some interviewers might
be looking for an optimal approach
others might be interested in how clean
your code is a good idea is to keep
communicating with your interviewer to
understand what they are looking for
remember an interview is supposed to be
a discussion not a vior so that's all
for today I hope I was able to help you
on how to excel in DSA interviews and
provide some useful information if you
have any further doubts please put them
in the comments below and we will be
happy to answer make sure to like and
share this video And subscribe to
scalers YouTube channel for more such
content all the
best
Посмотреть больше похожих видео
Is DSA worth it in 2024?
Which Programming Language Should You Choose for solving DSA Problems?
How to utilise B.Tech 2nd Year in 2024??🤯🧐🤔What to Choose in 2nd Year Coding or Academics??
90 DAYS PLACEMENT ROADMAP🔥| Step by Step Guide to CRACK ANY COMPANY | DSA, PROJECTS, CS SUBJECTS🧑💻🚀
How to start DSA from scratch? Important Topics for Placements? Language to choose? DSA Syllabus A-Z
Curriculum - Design Product To Encourage Voting (with LinkedIn PM)
5.0 / 5 (0 votes)