## Longest Palindromic Substring - Amazon Top Interview Questions

Given a string s, return the length of the longest palindromic substring. Constraints n ≤ 1,000 where n is the length of s Example 1 Input s = "mactacocatbook" Output 7 Explanation "tacocat" in the middle is the longest palindromic substring.

## Longest Sublist of 1s After K Sets - Amazon Top Interview Questions

You are given a list of integers nums containing 1s and 0s and an integer k. Given that you can set at most k 0s to 1s, return the length of the longest sublist containing all 1s. Constraints n ≤ 100,000 where n is the length of nums Example 1 Input nums = [1, 1, 1, 0, 0, 1, 0] k = 2 Output 6 Explanation We can set the two middle 0s to 1s and then the list becomes [1, 1, 1, 1, 1, 1, 0].

## Lowest Common Ancestor - Amazon Top Interview Questions

Given a binary tree root, and integers a and b, find the value of the lowest node that has a and b as descendants. A node can be a descendant of itself. All nodes in the tree are guaranteed to be unique. Constraints n ≤ 100,000 where n is the number of nodes in root Example 1 Input root = [0, [1, null, null], [2, [6, [3, null, null], [4, null, null]], [5, null, null]]] a = 3 b = 5 Output 2 Example 2 Input root = [0, [1, null, null], [2, [6, [3, null, null],

## Lowest Common Ancestor of List of Values - Amazon Top Interview Questions

Given a binary tree root containing unique values and a list of unique integers values, return the lowest common ancestor node that contains all values in values. You can assume that a solution exists. Constraints n ≤ 100,000 where n is the number of nodes in root Example 1 Input root = [1, [2, null, null], [3, [4, [6, null, null], [7, null, null]], [5, null, null]]] values = [5, 6, 7] Output [3, [4, [6, null, null], [7, null, null]], [5, null, null]]

## Making Change - Amazon Top Interview Questions

Find the minimum number of coins required to make n cents. You can use standard American denominations, that is, 1¢, 5¢, 10¢, and 25¢. Constraints 0 ≤ n < 2 ** 31 Example 1 Input n = 3 Output 3 Explanation You can make this with 3 pennies. Example 2 Input n = 5 Output 1 Explanation You can make this with a 5 cent coin. Example 3 Input n = 6 Output 2 Explanation You can make this with a 5 cent coin and a 1 cent coin.