1 of 40

Introduction to Technical Interviews

Jake Shoudy, Fisk University

Build for Everyone Template��Version 1.1

2 of 40

What to expect during the interview

​

Most technical interviews lasts between 45 mins and 1 hour�

  • Most virtual interviews will be on a shared coding document that allows for real-time collaborative remote coding between the candidate and the interviewer, complete with formatting and syntax highlighting. You will also simultaneously either be on a video call or phone call with your interviewer.�
  • Interviews usually include 1-3 technical questions each�
  • There will usually be time for short introductions and closing questions, however the majority of the time will be spent on technical questions�
  • If you need any accommodations during the interview process or have questions about assistive technology in virtual interviews, please let your recruiter know.

​

​

Build for Everyone Template��Version 1.1

3 of 40

Interview Assessment

​

The engineering skills being assessed

  • Communication and collaboration
  • Data structures and algorithms
  • Problem solving and analytical skills
  • Code understanding

​

What you won’t see

  • Brain teasers, puzzles, or trick questions
  • Perfect code

Build for Everyone Template��Version 1.1

4 of 40

Communication and Collaboration

​

Verbalize your thoughts

  • Restate the question to confirm understanding
  • Think out loud
  • Draw pictures to help visualize your solution (graphs)
  • Prefer to think in silence? Say so, then summarize

​

Listen to your interviewer

  • They want you to succeed
  • Ask clarifying questions before designing your solution �and writing your code
  • Are they providing a hint?

Build for Everyone Template��Version 1.1

5 of 40

Languages you could use, but are not limited to:

  • C/C++�
  • Java�
  • Python�
  • JavaScript�
  • Go

Build for Everyone Template��Version 1.1

6 of 40

Don’t worry too much about:

  • Small syntax errors�
  • Punctuation

Build for Everyone Template��Version 1.1

7 of 40

Interviewer considerations

​

  • How did the candidate analyze the problem?
  • Did the candidate miss any special or edge cases?
  • Did the candidate approach the problem methodically and logically?
  • Does the candidate have a strong foundation in basic computer science concepts?
  • Did the candidate produce working code? Did the candidate test the code?
  • Is the candidate’s code clean and easy to read and maintain?
  • Can the candidate explain their ideas clearly?

​

Build for Everyone Template��Version 1.1

8 of 40

Interview Tips

It is a dialogue,

NOT a monologue

Take

your

time

Explain your thought process

Build for Everyone Template��Version 1.1

9 of 40

Virtual Interview Tips

High Energy!

Stable WiFi

Clear and Quiet Background

Build for Everyone Template��Version 1.1

10 of 40

Interviewing

Step by step

Build for Everyone Template��Version 1.1

11 of 40

Steps for acing the technical interview

  1. Clarify the question�
  2. Design a solution�
  3. Write your code�
  4. Test your code

Build for Everyone Template��Version 1.1

12 of 40

1. Clarify the question

  • Do you understand what the question is asking?
    • What are example inputs and outputs? (i.e. test cases)�
  • Is there additional information that'd be helpful?
    • Can numbers be negative? Repeated?
    • Are values sorted? If they're not, can you assume there's a sort function you can call?
    • Do I need to handle invalid inputs or can I assume the input is valid?

�Why ask clarifying questions?

  • Clarifying questions demonstrate your communication skills.
  • Clarifying questions can save you a lot of time and avoid misunderstandings

Build for Everyone Template��Version 1.1

13 of 40

2. Design a solution

  • Do not start coding immediately.
  • Start with the first solution that comes to mind, then iterate.
  • Describe your algorithms and performances (what is its Big-O?).
  • Make sure you handle edge cases.
  • Think about other solutions you have seen or data structures you know and ask “would this be helpful?”
  • Think out loud.
    • You should be communicating with the interviewer during all of these steps.
    • Refine and improve solution collaboratively with your interviewer
    • It's ok to talk about ideas that you later realize don't work. It can actually be a good thing if you can explain the issue with certain ideas.

Build for Everyone Template��Version 1.1

14 of 40

3. Write your code

  • Break your solution into smaller parts using helper functions.

​

  • If you don’t know the exact API, ask the interviewer.

​

  • Write the code in the language and style you are most comfortable with (you will be asked to confirm your preferred programming language) �
  • It’s important to write full code (not pseudocode)

Build for Everyone Template��Version 1.1

15 of 40

4. Test your code

  • Don't assume your code works.�
  • Walkthrough your code line by line using your test cases from earlier in the process. Run through at least 1 or 2 test cases to check your work.
    • You can use your test cases you created in step 1!�
  • If you realize there are ways to optimize your solution even more, talk about it!

Build for Everyone Template��Version 1.1

16 of 40

Common mistakes to avoid

1. Jumping into code

​

2. Not talking about examples

and not thinking of testing

​

3. Not writing real code

​

4. Not understanding the question

or prematurely optimizing

​

Build for Everyone Template��Version 1.1

17 of 40

Final best practices tips

  • Explain- Err on the side of over communicating

​

  • Clarify- Many questions will be deliberately open-ended

​

  • Listen- An interview can be collaborative, use your interviewer as a resource and pay attention to any hints they might give you

​

  • Practice- There are no shortcuts, make sure to practice!

​

Build for Everyone Template��Version 1.1

18 of 40

A chance to

practice

Build for Everyone Template��Version 1.1

19 of 40

Sample Interview Question

#1

Build for Everyone Template��Version 1.1

20 of 40

Sample Interview Question

​

Write a function to detect if a string containing parentheses is balanced.

Build for Everyone Template��Version 1.1

21 of 40

1a) Clarifying

Write a function to detect if a string containing parentheses is balanced.

​

  • What does balanced mean?
    • Same number of open parentheses and closing parentheses. Each open/close parentheses must be in a pair
  • Does the order of the pairs matter?
    • Yes, open parentheses must come before closing parentheses
  • Do we want to return a boolean?
    • Yes
  • Can the string contain non parentheses characters?
    • Yes
  • What do we do if the string is empty or no parentheses?
    • Return True

Build for Everyone Template��Version 1.1

22 of 40

1b) Clarifying with Examples

  • “” -> True
  • “Hello” -> True
  • “()” -> True
  • “((()))” -> True
  • “()()()” -> True
  • “((hello)my(f(r)ie()))nd -> True
  • “)(“ -> False
  • “(()()))()” -> False
  • “(“ -> False
  • “)” -> False

Build for Everyone Template��Version 1.1

23 of 40

2) Design

  • Could count the # of open parentheses and the # of closed parentheses then return True if they are equal and False otherwise
    • Would this work?
    • No! Order of the parentheses matters
  • Every time I see a closing parentheses, it should “close out” an opening parentheses.
    • Keep track of all characters I have seen thus far. If I see a closing parentheses, remove all recent characters until I find an open parentheses, remove it.
    • If no open parentheses is found, return False
    • Will this work?
      • Seems like it?
    • What is the runtime?
      • O(n^2)

Build for Everyone Template��Version 1.1

24 of 40

3) Write code

def is_string_balanced(string):

characters = []

for char in string:

characters.append(char)

if char == ")":

element = ""

while element != "(":

if "(" not in characters:

return False

element = characters.pop()

return "(" not in characters

​

Build for Everyone Template��Version 1.1

25 of 40

3) Write code: optimize

def is_string_balanced(string):

open_parens = []

for char in string:

if char == "(":

open_parens.append(char)

elif char == ")":

if len(open_parens) == 0:

return False

open_parens.pop()

return len(open_parens) == 0

​

​

Build for Everyone Template��Version 1.1

26 of 40

3) Write code: solution w/ no extra data structure

def is_string_balanced(string):

open_count = 0

for char in string:

if char == "(":

open_count += 1

elif char == ")":

open_count -= 1

if open_count < 0:

return False

return open_count == 0

​

Build for Everyone Template��Version 1.1

27 of 40

4) Test Code

def is_string_balanced(string):

open_count = 0

for char in string:

if char == "(":

open_count += 1

elif char == ")":

open_count -= 1

if open_count < 0:

return False

return open_count == 0

​

Examples

  • “” -> True
  • “((hello)my(f(r)ie()))nd -> True
  • “(()()))()” -> False

​

Build for Everyone Template��Version 1.1

28 of 40

Sample Interview Question

#2

Build for Everyone Template��Version 1.1

29 of 40

Sample Interview Question

​

Find the index of the maximum value of an array of length N. The first K elements of the array are sorted in increasing value, and the last N-K elements are sorted in decreasing value.

​

For example, if we are given this array:

​

�

Our code should return the index of number 37 in the array (hint: what is the index of the first element of an array?)

​

Build for Everyone Template��Version 1.1

30 of 40

1a) Clarifying

​

  • Are we guaranteed the list only contains integers?
    • Yes
  • Can there be duplicates? Negative numbers?
    • There can be duplicates, but not consecutively (one while increasing and the other while decreasing).
    • Yes negative numbers are allowed
  • What if the list is empty?
    • Let’s assume the list is always non-empty
  • Can the list contain only increasing numbers with no decreasing numbers afterwards?
    • Yes, this is possible

Build for Everyone Template��Version 1.1

31 of 40

1b) Clarifying with Examples

  • [1, 2, 3, 2, 1] -> 2
  • [5] -> 0
  • [1, 10, 20, 30, 100, 150] -> 5
  • [-8, -5, -2, -3, -5, -10, -20] -> 2
  • [5, 3] -> 0

Build for Everyone Template��Version 1.1

32 of 40

2) Design

  • Loop over array using the index
    • If I find an index where the next value is smaller than the current value then return that index
    • If I reach the end, return the index of the last position
    • Will this work?
      • Seems like it?
    • What is the runtime?
      • O(n)

Build for Everyone Template��Version 1.1

33 of 40

Optimized Solution

Sometimes an optimized solution is not required, possible, or expected, especially for students early on in their college studies

​

​

Build for Everyone Template��Version 1.1

34 of 40

3) Write code

def find_max_index(nums):

for index in range(len(nums)):

if nums[index] > nums[index + 1]:

return index

return len(nums) - 1

Build for Everyone Template��Version 1.1

35 of 40

4) Test code

def find_max_index(nums):

for index in range(len(nums)):

if nums[index] > nums[index + 1]:

return index

return len(nums) - 1

Examples

  • [1, 2, 3, 2, 1] -> 2
  • [5, 3] -> 0
  • [1, 10, 20, 30, 100, 150] -> 5

​

Build for Everyone Template��Version 1.1

36 of 40

Testing and Fixing

  • Walk through the example and check the code
    • Imagine you have not written the code
    • Assume it does NOT work

Build for Everyone Template��Version 1.1

37 of 40

4b) Fix code

def find_max_index(nums):

for index in range(len(nums) - 1):

if nums[index] > nums[index + 1]:

return index

return len(nums) - 1

Build for Everyone Template��Version 1.1

38 of 40

4c) Test code again

def find_max_index(nums):

for index in range(len(nums)):

if nums[index] > nums[index + 1]:

return index

return len(nums) - 1

Examples

  • [1, 2, 3, 2, 1] -> 2
  • [5, 3] -> 0
  • [1, 10, 20, 30, 100, 150] -> 5

​

Build for Everyone Template��Version 1.1

39 of 40

Optimized Solution

  • Sometimes an optimized solution is not required, possible, or expected, especially for students early on in their college studies�
  • If we were going to optimize the solution for this question, we could ask the following additional clarifying questions:
    • Do we have to look at each element?
    • Have we seen any similar problems to this before?
    • Can we know if we are in the increasing/decreasing portion?
      • Binary search with a look left + right to determine where to go next
      • You might not know this yet from your studies, that’s ok!

​

​

​

Build for Everyone Template��Version 1.1

40 of 40

Optimized solution

def find_max_idx(sorted_array):

if not sorted_array:

return -1

start = 0

end = len(sorted_array) - 1

while end - start > 1:

middle = (start + end) // 2 # Python 3 floor divide.

if sorted_array[middle] < sorted_array[middle + 1]:

start = middle

elif sorted_array[middle] < sorted_array[middle - 1]:

end = middle

else:

return middle

if sorted_array[start] > sorted_array[end]:

return start

else:

return end

Build for Everyone Template��Version 1.1