Caren
June 06, 2020
2.1k

# CodePath SE102 - Week 1b

June 06, 2020

## Transcript

Example: 24 - Caren
Check our Slack channel for detailed instructions including

2. Intermediate Software Engineering
Week 1

3. Common interview mistakes:
• not communicating with interviewer
• doesn’t catch or can’t ﬁx bugs
• speed - interviewer wasn’t able to get a good
signal

4. U
M
P
I
R
E

5. Understand
Match
Plan
Implement
Review
Evaluate

6. Understand - Clarify what the interviewer is asking for
Match
Plan
Implement
Review
Evaluate

7. Understand - Clarify what the interviewer is asking for
Match - Identify similar patterns
Plan
Implement
Review
Evaluate

8. Understand - Clarify what the interviewer is asking for
Match - Identify similar patterns
Plan - Come up with algorithm, proof it works
Implement
Review
Evaluate

9. Understand - Clarify what the interviewer is asking for
Match - Identify similar patterns
Plan - Come up with algorithm, proof it works
Implement - Code
Review
Evaluate

10. Understand - Clarify what the interviewer is asking for
Match - Identify similar patterns
Plan - Come up with algorithm, proof it works
Implement - Code
Review - Test solution works as expected
Evaluate

11. Understand - Clarify what the interviewer is asking for
Match - Identify similar patterns
Plan - Come up with algorithm, proof it works
Implement - Code
Review - Test solution works as expected
Evaluate - Analyze run time and space complexity

12. Understand - Clarify what the interviewer is asking for
Match - Identify similar patterns
Plan - Come up with algorithm, proof it works
Implement - Code
Review - Test solution works as expected
Evaluate - Analyze run time and space complexity

13. In Class Exercise - UMPIRE Warmup

14. Return distinct values from a list including duplicates
Given {1, 2, 6, 6, 6, 10, 14, 14} ; Return -> {1, 2, 6, 10, 14}

15. Return distinct values from a list including duplicates
Given {1, 2, 6, 6, 6, 10, 14, 14} ; Return -> {1, 2, 6, 10, 14}
Understand:

16. Return distinct values from a list including duplicates
Given {1, 2, 6, 6, 6, 10, 14, 14} ; Return -> {1, 2, 6, 10, 14}
Understand:
- is the input always sorted for us?
- are inputs always only integers?

17. Return distinct values from a list including duplicates
Given {1, 2, 6, 6, 6, 10, 14, 14} ; Return -> {1, 2, 6, 10, 14}
Understand:
- is the input always sorted for us?
- are inputs always only integers?
- Given {1, 1, 1} ; Return …?

18. Return distinct values from a list including duplicates
Given {1, 2, 6, 6, 6, 10, 14, 14} ; Return -> {1, 2, 6, 10, 14}
Understand:
- is the input always sorted for us?
- are inputs always only integers?
- Given {1, 1, 1} ; Return {1}

19. Return distinct values from a list including duplicates
Given {1, 2, 6, 6, 6, 10, 14, 14} ; Return -> {1, 2, 6, 10, 14}
Understand:
- is the input always sorted for us?
- are inputs always only integers?
- Given {1, 1, 1} ; Return {1}
- Given {1, 2, 3} ; Return …?

20. Return distinct values from a list including duplicates
Given {1, 2, 6, 6, 6, 10, 14, 14} ; Return -> {1, 2, 6, 10, 14}
Understand:
- is the input always sorted for us?
- are inputs always only integers?
- Given {1, 1, 1} ; Return {1}
- Given {1, 2, 3} ; Return {1, 2, 3}

21. Return distinct values from a list including duplicates
Given {1, 2, 6, 6, 6, 10, 14, 14} ; Return -> {1, 2, 6, 10, 14}
Understand:
- is the input always sorted for us?
- are inputs always only integers?
- Given {1, 1, 1} ; Return {1}
- Given {1, 2, 3} ; Return {1, 2, 3}
- Given {15, 6, 10, 5, 12, 6} ; Return … ?

22. Return distinct values from a list including duplicates
Given {1, 2, 6, 6, 6, 10, 14, 14} ; Return -> {1, 2, 6, 10, 14}
Understand:
- is the input always sorted for us?
- are inputs always only integers?
- Given {1, 1, 1} ; Return {1}
- Given {1, 2, 3} ; Return {1, 2, 3}
- Given {15, 6, 10, 5, 12, 6} ; Return {15, 6, 10, 5, 12}

23. Return distinct values from a list including duplicates
Given {1, 2, 6, 6, 6, 10, 14, 14} ; Return -> {1, 2, 6, 10, 14}
Understand:
- is the input always sorted for us?
- are inputs always only integers?
- Given {1, 1, 1} ; Return {1}
- Given {1, 2, 3} ; Return {1, 2, 3}
- Given {15, 6, 10, 5, 12, 6} ; Return {15, 6, 10, 5, 12}
Follow up question: does it matter what order our return list is?

24. Return distinct values from a list including duplicates
Given {1, 2, 6, 6, 6, 10, 14, 14} ; Return -> {1, 2, 6, 10, 14}
Match:

25. Return distinct values from a list including duplicates
Given {1, 2, 6, 6, 6, 10, 14, 14} ; Return -> {1, 2, 6, 10, 14}
Match:
- are there any common patterns we can apply here?

26. Return distinct values from a list including duplicates
Given {1, 2, 6, 6, 6, 10, 14, 14} ; Return -> {1, 2, 6, 10, 14}
Match:
- are there any common patterns we can apply here?
- coming in future sessions..
- hash table
- sort input ﬁrst?

27. Return distinct values from a list including duplicates
Given {1, 2, 6, 6, 6, 10, 14, 14} ; Return -> {1, 2, 6, 10, 14}
Plan

28. Return distinct values from a list including duplicates
Given {1, 2, 6, 6, 6, 10, 14, 14} ; Return -> {1, 2, 6, 10, 14}
Plan:
- possible solutions:
(1) iterate through array, put values in hash table, if value already

29. Return distinct values from a list including duplicates
Given {1, 2, 6, 6, 6, 10, 14, 14} ; Return -> {1, 2, 6, 10, 14}
Plan:
- possible solutions:
(1) iterate through array, put values in hash table, if value already
(2) sort array, add integer to numsToReturn if previous integer is not
the same

30. Return distinct values from a list including duplicates
Given {1, 2, 6, 6, 6, 10, 14, 14} ; Return -> {1, 2, 6, 10, 14}
Implement:
code up solution in repl.it !

31. Return distinct values from a list including duplicates
Given {1, 2, 6, 6, 6, 10, 14, 14} ; Return -> {1, 2, 6, 10, 14}
Review:
run one or two inputs through our solution

32. Return distinct values from a list including duplicates
Given {1, 2, 6, 6, 6, 10, 14, 14} ; Return -> {1, 2, 6, 10, 14}
Evaluate:
what’s the space / run time complexity of our solution?
what tradeoffs did we have to make?

33. In Class Exercise - UMPIRE Warmup

34. In Class Exercise - UMPIRE Warmup
Work in groups to get more comfortable with UMPIRE

35. In Class Exercise - UMPIRE Warmup
Work in groups to get more comfortable with UMPIRE
Review UMPIRE together, make sure everybody has a good
understanding of what should be done at each step

36. In Class Exercise - UMPIRE Warmup
Work in groups to get more comfortable with UMPIRE
Review UMPIRE together, make sure everybody has a good
understanding of what should be done at each step
Review a sample problem solved with the UMPIRE method

37. In Class Exercise - UMPIRE Warmup
Work in groups to get more comfortable with UMPIRE
Review UMPIRE together, make sure everybody has a good
understanding of what should be done at each step
Review a sample problem solved with the UMPIRE method
Create a shared document in repl.it to solve the problem together
with the UMPIRE steps. Round robin status!

38. In Class Exercise - UMPIRE Warmup
Work in groups to get more comfortable with UMPIRE
Review UMPIRE together, make sure everybody has a good
understanding of what should be done at each step
Review a sample problem solved with the UMPIRE method
Create a shared document in repl.it to solve the problem together
with the UMPIRE steps. Round robin status!

After 45 minutes, we’ll regroup and review the problem

39. Questions?
your name?? (Example: 24 - Caren )

40. How’d it go?

41. Before Monday midnight..

42. Before Monday midnight..
Review UMPIRE
lecture slides also linked in course portal

43. Before Monday midnight..
Review UMPIRE
lecture slides also linked in course portal
Review solutions to our in class exercises

44. Before Monday midnight..
Review UMPIRE
lecture slides also linked in course portal
Review solutions to our in class exercises
Work on optional practice problems provided in course portal

45. Before Monday midnight..
Review UMPIRE
lecture slides also linked in course portal
Review solutions to our in class exercises
Work on optional practice problems provided in course portal
Complete HackerRank assessment!

46. HackerRank
Don’t stress out about it too much!
Prep by doing optional practice problems
Things you need to know for this week:
UMPIRE
Code tracing

47. Next week
Big O

Hash Tables
Panel!