Upgrade to Pro — share decks privately, control downloads, hide ads and more …

CodePath SE102 - Week 1b

Caren
June 06, 2020

CodePath SE102 - Week 1b

Caren

June 06, 2020
Tweet

More Decks by Caren

Other Decks in Education

Transcript

  1. Prepend your name with your group number! 
 Example: 24

    - Caren Check our Slack channel for detailed instructions including your group number Also add a profile picture for Slack if you haven’t already
  2. Common interview mistakes: • not communicating with interviewer • doesn’t

    catch or can’t fix bugs • speed - interviewer wasn’t able to get a good signal
 

  3. Understand - Clarify what the interviewer is asking for Match

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

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

    - Identify similar patterns Plan - Come up with algorithm, proof it works Implement - Code Review Evaluate
  6. 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
  7. 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
  8. 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
  9. Return distinct values from a list including duplicates Given {1,

    2, 6, 6, 6, 10, 14, 14} ; Return -> {1, 2, 6, 10, 14} 

  10. Return distinct values from a list including duplicates Given {1,

    2, 6, 6, 6, 10, 14, 14} ; Return -> {1, 2, 6, 10, 14} Understand: 
 
 

  11. 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? 
 

  12. 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 …? 
 

  13. 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}
 

  14. 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 …? 
 

  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: 
 - 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}
 

  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? - Given {1, 1, 1} ; Return {1}
 - Given {1, 2, 3} ; Return {1, 2, 3}
 - Given {15, 6, 10, 5, 12, 6} ; Return … ? 
 

  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 {1}
 - Given {1, 2, 3} ; Return {1, 2, 3}
 - Given {15, 6, 10, 5, 12, 6} ; Return {15, 6, 10, 5, 12}
 

  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}
 - 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?
 

  19. Return distinct values from a list including duplicates Given {1,

    2, 6, 6, 6, 10, 14, 14} ; Return -> {1, 2, 6, 10, 14} Match: 
 
 
 

  20. 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?
 
 
 

  21. 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 first?
 
 

  22. Return distinct values from a list including duplicates Given {1,

    2, 6, 6, 6, 10, 14, 14} ; Return -> {1, 2, 6, 10, 14} Plan
 
 

  23. 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 exists, don't add to numsToReturn
 
 
 

  24. 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 exists, don't add to numsToReturn
 (2) sort array, add integer to numsToReturn if previous integer is not the same
 
 

  25. 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 ! 
 
 

  26. 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
 
 

  27. 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?
  28. In Class Exercise - UMPIRE Warmup Work in groups to

    get more comfortable with UMPIRE
  29. 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
  30. 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
  31. 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!
 

  32. 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
  33. Before Monday midnight.. Review UMPIRE 
 guide linked in course

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

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

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

    portal
 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!
  37. 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