Introduction to Technical Interviews
Jake Shoudy, Fisk University
Build for Everyone Template��Version 1.1
What to expect during the interview
Most technical interviews lasts between 45 mins and 1 hour�
Build for Everyone Template��Version 1.1
Interview Assessment
The engineering skills being assessed
What you won’t see
Build for Everyone Template��Version 1.1
Communication and Collaboration
Verbalize your thoughts
Listen to your interviewer
Build for Everyone Template��Version 1.1
Languages you could use, but are not limited to:
Build for Everyone Template��Version 1.1
Don’t worry too much about:
Build for Everyone Template��Version 1.1
Interviewer considerations
Build for Everyone Template��Version 1.1
Interview Tips
It is a dialogue,
NOT a monologue
Take
your
time
Explain your thought process
Build for Everyone Template��Version 1.1
Virtual Interview Tips
High Energy!
Stable WiFi
Clear and Quiet Background
Build for Everyone Template��Version 1.1
Interviewing
Step by step
Build for Everyone Template��Version 1.1
Steps for acing the technical interview
Build for Everyone Template��Version 1.1
1. Clarify the question
�Why ask clarifying questions?
Build for Everyone Template��Version 1.1
2. Design a solution
Build for Everyone Template��Version 1.1
3. Write your code
Build for Everyone Template��Version 1.1
4. Test your code
Build for Everyone Template��Version 1.1
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
Final best practices tips
Build for Everyone Template��Version 1.1
A chance to
practice
Build for Everyone Template��Version 1.1
Sample Interview Question
#1
Build for Everyone Template��Version 1.1
Sample Interview Question
Write a function to detect if a string containing parentheses is balanced.
Build for Everyone Template��Version 1.1
1a) Clarifying
Write a function to detect if a string containing parentheses is balanced.
Build for Everyone Template��Version 1.1
1b) Clarifying with Examples
Build for Everyone Template��Version 1.1
2) Design
Build for Everyone Template��Version 1.1
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
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
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
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
Build for Everyone Template��Version 1.1
Sample Interview Question
#2
Build for Everyone Template��Version 1.1
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
1a) Clarifying
Build for Everyone Template��Version 1.1
1b) Clarifying with Examples
Build for Everyone Template��Version 1.1
2) Design
Build for Everyone Template��Version 1.1
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
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
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
Build for Everyone Template��Version 1.1
Testing and Fixing
Build for Everyone Template��Version 1.1
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
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
Build for Everyone Template��Version 1.1
Optimized Solution
Build for Everyone Template��Version 1.1
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