weeks! Resumes - I spent about 30 seconds - 1 minute on each one - Any GPA less than 3.9 didn’t seem impressive - Bolded words and terms were really helpful - Small achievements like “Placed 1st in National Olympiad” or “Won 1st place at X hackathon” really stood out - Don’t send generic cover letters Having a portfolio website stood out
- 9 people got 100% - Code quality mattered well named variables comments or well named methods helper functions for less giant blocks of codde unnecessary lines? - Time took to ﬁnish test
thought process - be able to talk about why you’re interested in the position - think about what you want to ask when the interviewer gives you the chance Don’t - straight up copy from stack overﬂow
write a function to ﬁnd the kth smallest element in it. Example 1: Input: root = [3,1,4,null,2], k = 1 3 / \ 1 4 \ 2 Output: 1 Example 2: Input: root = [5,3,6,2,4,null,null,1], k = 3 5 / \ 3 6 / \ 2 4 / 1 Output: 3
search tree, write a function to ﬁnd the kth smallest element in it. Example 1: Input: root = [3,1,4,null,2], k = 1 3 / \ 1 4 \ 2 Output: 1 Example 2: Input: root = [5,3,6,2,4,null,null,1], k = 3 5 / \ 3 6 / \ 2 4 Output: 3
write a function kthSmallest to ﬁnd the kth smallest element in it. Solution 1: - do an inorder traversal - store visited notes in an array / stack - get the kth element of the array or pop from stack until we’ve found the kth element after a full traversal
write a function kthSmallest to ﬁnd the kth smallest element in it. Solution 1: - do an inorder traversal - store visited notes in an array / stack - get the kth element of the array or pop from stack until we’ve found the kth element after a full traversal What’s the run time and space complexity of this solution?
write a function kthSmallest to ﬁnd the kth smallest element in it. What if the BST is modiﬁed (we add or delete nodes) often and we need to ﬁnd the kth smallest frequently? How can we optimize our solution for this case?
write a function kthSmallest to ﬁnd the kth smallest element in it. What if the BST is modiﬁed (we add or delete nodes) often and we need to ﬁnd the kth smallest frequently? How can we optimize our solution for this case? What if we could modify the structure of the nodes?
write a function kthSmallest to ﬁnd the kth smallest element in it. Generating rank of nodes: class TreeNodeWithRank { int val; int count; TreeNodeWithCount left; TreeNodeWithCount right; TreeNodeWithCount(int x) {val = x; count = 1;}; } private TreeNodeWithRank buildTreeWithRank(TreeNode root) { if (root == null) return null; TreeNodeWithRank rootWithRank = new TreeNodeWithRank(root.val); rootWithRank.left = buildTreeWithRank(root.left); rootWithRank.right = buildTreeWithRank(root.right); if (rootWithRank.left != null) rootWithRank.count += rootWithRank.left.count; if (rootWithRank.right != null) rootWithRank.count += rootWithRank.right.count; return rootWithRank; }
write a function kthSmallest to ﬁnd the kth smallest element in it. What if the BST is modiﬁed (we add or delete nodes) often and we need to ﬁnd the kth smallest frequently? How can we optimize our solution for this case? What if we could modify the structure of the nodes? We can let each node track it’s “rank” (the number of nodes in its subtrees + 1)
write a function kthSmallest to ﬁnd the kth smallest element in it. What if the BST is modiﬁed (we add or delete nodes) often and we need to ﬁnd the kth smallest frequently? How can we optimize our solution for this case? What if we could modify the structure of the nodes? We can let each node track it’s “rank” (the number of nodes in its subtrees + 1) Why +1 ??
going to ask the other person and understand the different solutions 40 minutes : First question 40 minutes : Second question We’ll send out an announcement when 1) 15 minute prep time is over 2) Your pair should move from question 1 to question 2 3) We should all regroup and come back from the breakout room
session, we expect: DO: Have an ongoing conversation DO: Pseudocode and example input / outputs before implementation DO: Practice running the code and debugging live DO: Wrap up with a time/ space complexity analysis if you run out of time DON’T: look at the solution during the interview DON’T: using leetcode to test the code Questions? Use the Zoom “raise your hand” feature
is to have working code with tests by the end of the session Feel free to move on to the other question before we make the announcement Leftover time? Try tackling a post assessment question together
problems after a long day of work! Now it’ll just be so much easier when you do them when you’re not so tired. Writing test cases before starting. It’s a great way to both think through the problem and have test cases to run afterwards! Omar did a great job of this! A lot of people were doing really well talking though their thought process as an interviewee and having their partner give them suggestions along the way Great job Rhythm, Aleksandra, Emma, Roshan, Anish, and Qiuxuan
2-3 hints for your problem Before starting implementation, it’s always good to discuss about space and run time complexity. Before running you code or saying ‘okay this is my solution’ on a whiteboard, it’s always good to ﬁnd your own bugs before the interviewer points them out.