## Longest Increasing Subsequence - Amazon Top Interview Questions

Given an unsorted list of integers nums, return the longest strictly increasing subsequence of the array. Bonus: Can you solve it in \mathcal{O}(n \log n)O(nlogn) time? Constraints n ≤ 1,000 where n is the length of nums Example 1 Input nums = [6, 1, 7, 2, 8, 3, 4, 5] Output 5 Explanation Longest increasing subsequence would be [1, 2, 3, 4, 5] Example 2 Input nums = [12, 5, 6, 25, 8, 11, 10] Output 4 Explanation One longest increasing subseque

## Make Target List with Increment and Double Operations - Amazon Top Interview Questions

You are given a list of non-negative integers target. Consider a list A of the same length as target containing all zeros initially. In one operation, you can increment one number in A, or double every number in A. Return the minimum number of operations required to turn A into target. Constraints 0 ≤ n ≤ 100,000 where n is the length of target Example 1 Input target = [3, 2, 2] Output 5 Explanation First, we start with A = [0, 0, 0] We increment A and get [1, 0,

## Number of Sublists With Sum of Target - Amazon Top Interview Questions

Given a list of integers nums and an integer target, return the number of sublists whose sum is equal to target. Constraints n ≤ 100,000 where n is the length of nums Example 1 Input nums = [2, 0, 2] target = 2 Output 4 Explanation We have these sublists whose sum is 2: , [2, 0], [0, 2], 

## Swappable Trees - Amazon Top Interview Questions

Given two trees root0 and root1, return whether you can transform root0 into root1 by swapping any node's left and right subtrees any number of times. Example 1 Input root0 = [1, [3, null, null], [4, [0, null, [2, null, null]], null]] root1 = [1, [3, null, null], [4, [0, null, [2, null, null]], null]] Output True

## Hit Counter - Amazon Top Interview Questions

Implement a hit counter which keeps track of number of the number of hits in the last 60 seconds. add(int timestamp) which adds timestamp in seconds in the hit counter count(int timestamp) which returns the number of hits that have been made in the last 60 seconds, given the current time is timestamp. You can assume that the timestamps passed into add and count are monotonically increasing. Constraints n ≤ 100,000 where n is the number of calls that are made to add and count Exampl