title-img


Longest Common Prefix - Amazon Top Interview Questions

Given a list of lowercase alphabet strings words, return the longest common prefix. Example 1 Input words = ["anthony", "ant", "antigravity"] Output "ant" Explanation "ant" is the longest common prefix between the three strings.

View Solution →

Merging Two Sorted Lists - Amazon Top Interview Questions

Given two lists of integers a and b sorted in ascending order, merge them into one large sorted list. Constraints 0 ≤ n ≤ 200,000 where n is the length of a 0 ≤ m ≤ 200,000 where m is the length of b Example 1 Input a = [5, 10, 15] b = [3, 8, 9] Output [3, 5, 8, 9, 10, 15]

View Solution →

Wolf of Wall Street 2 - Amazon Top Interview Questions

Given a list of integers prices representing the stock prices of a company in chronological order, return the maximum profit you could have made from buying and selling that stock once. You must buy before you can sell it. Note: You are not required to buy or sell the stock. Constraints n ≤ 100,000 where n is the length of prices Example 1 Input prices = [9, 11, 8, 5, 7, 10] Output 5 Explanation You can buy at 5 and sell at 10. Example 2 Input prices = [1, 2

View Solution →

Equivalent Pairs - Amazon Top Interview Questions

You are given a list of integers nums. Return the number of pairs i < j such that nums[i] = nums[j]. Constraints 0 ≤ n ≤ 100,000 where n is the length of nums Example 1 Input nums = [3, 2, 3, 2, 2] Output 4 Explanation We have index pairs (0, 2), (1, 3), (1, 4), (3, 4).

View Solution →

Linked List Deletion - Amazon Top Interview Questions

Given a singly linked list node, and an integer target, return the same linked list with all nodes whose value is target removed. Constraints n ≤ 100,000 where n is the number of nodes in node Example 1 Input node = [0, 1, 1, 2] target = 1 Output [0, 2]

View Solution →