Complete-Preparation

πŸŽ‰ One-stop destination for all your technical interview Preparation πŸŽ‰

View the Project on GitHub

Leetcode Problem 1100-1199

1137. N-th Tribonacci Number 🌟

Recursive Solution(TLE)

Memoization(Top-Down) (5ms-AC)

Tabulation (Bottom-Up) (0ms-AC)

Optimized Space (0ms-AC)


1143. Longest Common Subsequence 🌟🌟

Recursive Solution (TLE)

Memoization (Top-Down) (AC)

Tabulation (Bottom-Up) (AC)


1161. Maximum Level Sum of a Binary Tree 🌟🌟

Previous Questions

  1. Binary tree level order traversal
  2. Binary tree level order traversal - II
  3. Binary tree zig-zag level order traversal
  4. Average of levels
  5. Binary tree right side view
  6. largest value in each tree row
  7. Populating next right pointer
  8. n-ary tree level order traversal

1178. Number of Valid Words for Each Puzzle 🌟🌟🌟

Bit masking with hashmap

Interview Tips

Interview Tip-1 In a real interview, if you are unsure how to solve the problem, a good first step is to remain calm and reread the problem description looking for hidden clues. Also, remember to ask the interviewer about the problem constraints. The constraints are very important for solving problems as they can help us determine which data structures and algorithms can feasibly be used to solve the problem. However, if the interviewer chooses to deliberately hide the constraints, then they likely want you to find different methods under different assumed constraints. Although, on rare occasions, a problem may be too simple to provide constraints.
Interview Tip-2 A constraint under `10` usually accepts a method with `N!` time complexity with respect to this constraint. Factorial time complexities can occur for operations like finding all permutations from a set or using brute-force to solve the traveling salesman problem. A constraint under `30` usually accepts a method with `2^N` time complexity at worst with respect to this constraint. Some examples include iterating over all combinations or subsets from a set or some brute-force solutions that use `DFS`. However, a solution with better time complexity can still exist even when the constraints are small. One should use the constraints to estimate the complexity of the worst acceptable solution, not the best solution.
Interview Tip-3 When you still do not have any idea after rereading the problem, you can try a brute-force method that works but may have an unacceptable time complexity. Then you can either try to improve on the brute-force method or gain some insight from the brute-force method.
Interview Tip-4 In an interview, if the first solution that comes to mind involves a complex data structure, you can wait a minute and try thinking of other similar methods. In a real-world setting, we typically prioritize efficiency and readability. We prioritize these characteristics in an interview setting as well, however, we also value solutions that we are less likely to make a mistake while coding and solutions that do not require a long time to code. In this problem, you should consider your level of familiarity with the trie data structure before choosing between implementing a solution using a trie or a set. If the more comfortable approach is not the most efficient, then you should also weigh the increased chance of making a mistake versus the gain of having a more efficient solution. Worry not, as we will cover both methods in this article.

Must Read: