-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrepeat-questions.txt
More file actions
63 lines (61 loc) · 8.1 KB
/
repeat-questions.txt
File metadata and controls
63 lines (61 loc) · 8.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
166.majority-element.py - Boyer Moore Algorithm, voting
151.reverse-words-in-a-string.py - never done/understood fully
1540.can-convert-string-in-k-moves.py - String conversion
215.kth-largest-element-in-an-array.py - Quickselect practice, optional max heap or just sort
283.move-zeroes.py - Think about how to partition the array, what needs to be at the beginning? Maybe move it there
347.top-k-frequent-elements.py - Bucket Sort, find highest frequency
219.contains-duplicate-ii.py - Solved but not optimal think of which TECHNIQUE to use, hashmap is only part of it
15.3sum.py - didn't solve this one, think of 2sum and 2sum II
567.permutation-in-string.py - got non-linear time solution, keep in mind exactly HOW sliding windows work (pop, add per move)
repeate one more time:
98.validate-binary-search-tree.py - solved with a tip, try again. If you've found the conditions for a BST, try to simplify them to something managable
100.same-tree.py - solved but with big problems - should be easy. Just simplify, no need to do null checks, it's just as fast to do that in a recursive call and return immediately.
110.balanced-binary-tree.py - solved correctly but not quickly enough, repeat one more time and keep in mind what the base case should be and what algo to use.
121.best-time-to-buy-and-sell-stock.py - done with hint, simple question - understand what you are measuring and which simple comparison you need
125.valid-palindrome.py - solved, maybe retry next time without using `.isalnum()` python function. How can you determine whether a char is within a range of chars? There's some nice trick that would involve `<=`.
143.reorder-list.py - got it but pretty ineffiecient, think of the easiest way to find the middle of a linked list, think of another problem where you found kth element counted from the end
146.lru-cache.py - got the technique after a hint, good question - repeat one more time. Make sure to create helper functions if needed and to check the logic, debugging can be very hard.
150.evaluate-reverse-polish-notation.py - done but the technique how and when to order numbers to stack should be revised
189.rotate-array.py - solved but no O(1) space complexity, hard to come up with technique write the start and result and retry maybe
205.isomorphic-strings.py - solved once with hint, you need to compare one string with the other AND vice versa
206.reverse-linked-list.py - Solved on second try (remember to use multiple vars, not one!). Solved with recursion. Attempt again but this time no helper function! Theres a nice technique to make the current nodes next node to point to oneselve or somewhere else.
223.implement-stack-using-queues.py - solved with hint. Don't assume the time complexity should be the of the classical stack (O(1)), instead think about how to most efficiently reduce the complexity so that it happens as infrequent as possible (only on push or only on pop?)
226.invert-binary-tree.py - same as 104, figured out technique but maybe no need for helper function? Just call the main function.
230.kth-smallest-element-in-a-bst.py - didn't solve it, repeat DFS, BFS, how first order traversal/post order traversal etc. work and can be achieved
235.lowest-common-ancestor-of-a-binary-search-tree.py - solved but solution was not most efficient, think about the core idea of what the path before the split is, just follow it.
383.ransom-note.py - solved without major issues besides some syntax errors, maybe repeat to practice anagrams and such
509.fibonacci-number.py - solved iteratively and recursively but forgot the math. Try again without looking up the fibonacci sequence.
543.diameter-of-binary-tree.py - solved it basically perfectly but the last small mathematical step was missing, think about how to traverse each node and what exactly do you want to record to return later it's not the height of the tree, that's just what the nested function returns not the "main" function. Try again!
704.binary-search.py - done once but forgot, retry one more time - memorize the algo. Especially what's the condition for the iteration?
875.koko-eating-bananas.py - figured out after tip, remember how binary search works and WHAT you are searching for in this quesiton, set the lowest, highest points for binary search correctly
1448.count-good-nodes-in-binary-tree.py - got it after looking at a tip TWICE, try again a third time! retry both - recursive and iterative solution. This about what information should be on the call stack and how to pass it down/modify it.
1470.shuffle-the-array.py - easy, solved - there's a more complex bitshift solution where you store 2 values in one int, maybe attempt to do that
2873.maximum-value-of-an-ordered-triplet-i.py - solved with hint for O(n^3) solution. After learning greedy algorithms retry.
1700.number-of-students-unable-to-eat-lunch.py - solved without problems, repeat one more time with dict and use a Counter to practice these. Will make the code cleaner!
Done:
3.longest-substring-without-repeating-characters.py - done but took too long and had unnessecary code (not optimized), solved without issues on second try, maybe redo - very nice usage of sets.
2.add-two-numbers.py - done but not good time and non-efficiencies in code - think how you can write cleaner/smarter and shorter, remove unnessecary lines
11.container-with-most-water.py - solved with a hint. Solved without hint on second try. Remember parantheses and don't overcomplicate! very similar to 121.
12.integer-to-roman.py - solved basically without issues, had small issue which was fixed after one test run. Recalculate your maths!
13.roman-to-integer.py - solved with basically no problems, always draw out the problem first!
19.remove-nth-node-from-end-of-list.py - done but code might want some optimizations (unnessecary None checks etc.)
20.valid-parentheses.py - done on second try, might repeat since there is a nice concept on how to compare values
21.merge-two-sorted-lists.py - done twice without issues, maybe repeat for understanding? Nice concept is dummy nodes and how to optimize when you already found the solution (just append the linked list)
26.remove-duplicates-from-sorted-array.py - solved perfectly, some small hiccups like unnessecary variables etc.
27.remove-element.py - done perfectly, small issues like unnessecary variables
49.group-anagrams.py - done with sort and non-sort approach - maybe retry without coding to come up with non code appraoch
58.length-of-last-word.py - solved, maybe repeat to actually use while loop and use good conditions in while loop instead of for loops with if statements.
74.search-a-2d-matrix.py - done with no issues, maybe repeat for understanding of binary search application?
102.binary-tree-level-order-traversal.py - done with little to no issues, maybe repeat to understand some logic stuff - edit: redone with BFS, maybe repeat to understand dequeue BFS
104.maximum-depth-of-binary-tree.py - done with recursive DFS and stack DFS, redo stack solution potentially to solidify stack technique
138.copy-list-with-random-pointer.py - done once with a hint and once by remembering. Great technique used to map objects to one another. Maybe repeat wihtout coding and code if needed? think about how you can identify what Node points to which other objects, using the val wont work, why?
155.min-stack.py - done, remember CORE idea about how stack works! think of how to store the min value for the current element
167.two-sum-ii-input-array-is-sorted.py - actually solved without problems, might retry to refresh
199.binary-tree-right-side-view.py - done with custom recursive solution as in 102 (recursive) - also now redone with BFS + deque
242.valid-anagram.py - Solved with array and using ord() to get ACII value.
344.reverse-string.py - done, not really worth repeating unless for basic techniques
438.find-all-anagrams-in-a-string.py - done on first try - very similar to 567, maybe repeat with better implementation
643.maximum-average-subarray-i.py - done on first try - maybe repeat to solidify static size sliding window
682.baseball-game.py - done perfectly on first try
1472.design-browser-history.py - solved with linked list, maybe reattempt but this time use an array?
1929.concatenation-of-array.py - no need to repeat, very simple