contents(optimize): Bullet point formatting (#588)

Co-authored-by: Panda Noodles <pandanoodles418@users.noreply.github.com>
pull/593/head
PandaNoodles418 1 year ago committed by GitHub
parent 2715cb88e9
commit 55ba8dcf68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -122,7 +122,11 @@ This discussion can range from a few minutes to up to 5-10 minutes depending on
- ✅ If you get stuck on the approach or optimization, use [this structured way](./coding-interview-techniques.md) to jog your memory / find a good approach - ✅ If you get stuck on the approach or optimization, use [this structured way](./coding-interview-techniques.md) to jog your memory / find a good approach
- ✅ Explain a few approaches that you could take at a high level (don't go too much into implementation details). Discuss the tradeoffs of each approach with your interviewer as if the interviewer was your coworker and you all are collaborating on a problem. - ✅ Explain a few approaches that you could take at a high level (don't go too much into implementation details). Discuss the tradeoffs of each approach with your interviewer as if the interviewer was your coworker and you all are collaborating on a problem.
> For algorithmic questions, space/time is a common tradeoff. Let's take the famous [Two Sum](https://leetcode.com/problems/two-sum/) question for example. There are two common solutions - (1) use nested for loops. This would be O(n<sup>2</sup>) in terms of time complexity and O(1) in terms of space. (2) In one pass of the array, you would hash a value to its index into a hash table. For subsequent values, look up the hash table to see if you can find an existing value that can sum up to the target. This approach is O(N) in terms of both time and space. Discuss both solutions, mention the tradeoffs and conclude on which solution is better (typically the one with lower time complexity) > For algorithmic questions, space/time is a common tradeoff. Let's take the famous [Two Sum](https://leetcode.com/problems/two-sum/) question for example. There are two common solutions
>
> 1. Use nested for loops. This would be O(n<sup>2</sup>) in terms of time complexity and O(1) in terms of space.
> 2. In one pass of the array, you would hash a value to its index into a hash table. For subsequent values, look up the hash table to see if you can find an existing value that can sum up to the target. This approach is O(N) in terms of both time and space. Discuss both solutions, mention the tradeoffs and conclude on which solution is better (typically the one with lower time complexity)
- ✅ State and explain the time and space complexity of your proposed approach(es). - ✅ State and explain the time and space complexity of your proposed approach(es).
> Mention the Big O complexity for time and explain why (e.g O(n<sup>2</sup>) for time because there are nested for loops, O(n) for space because an extra array is created). Master all the time and space complexity using the [algorithm optimization techniques](./coding-interview-techniques.md#how-to-optimize-your-approach-or-solution). > Mention the Big O complexity for time and explain why (e.g O(n<sup>2</sup>) for time because there are nested for loops, O(n) for space because an extra array is created). Master all the time and space complexity using the [algorithm optimization techniques](./coding-interview-techniques.md#how-to-optimize-your-approach-or-solution).
- ✅ Agree on the most ideal approach and optimize it. Identify repeated/duplicated/overlapping computations and reduce them via caching. Refer to the page on [optimizing your solution](./coding-interview-techniques.md#how-to-optimize-your-approach-or-solution). - ✅ Agree on the most ideal approach and optimize it. Identify repeated/duplicated/overlapping computations and reduce them via caching. Refer to the page on [optimizing your solution](./coding-interview-techniques.md#how-to-optimize-your-approach-or-solution).

Loading…
Cancel
Save