Maximal Sublist Product - Amazon Top Interview Questions
Given a list of integers nums, find the maximum product of integers in any contiguous sublist. Constraints 1 ≤ n ≤ 100,000 where n is the length of nums Example 1 Input nums = [1, 10, 2, 0, 3, 5] Output 20 Explanation Maximum product sublist is [1, 10, 2] and 1 * 10 * 2 = 20
View Solution →Course Scheduling - Amazon Top Interview Questions
You are given a two-dimensional integer list courses representing an adjacency list where courses[i] is the list of prerequisite courses needed to take course i. Return whether it's possible to take all courses. Constraints n, m ≤ 250 where n and m are the number of rows and columns in matrix. Example 1 Input courses = [ [1], [], [0] ] Output True Explanation We can take course 1, then course 0, and then course 2
View Solution →Uber Pool - Amazon Top Interview Questions
You are given a two-dimensional integer list requested_trips containing [start_x, end_x, num_passengers], and an integer capacity. Each requested trip asks to pick up num_passengers passenger at start_x and drop them off at end_x. You also have a car with the given capacity, and start at x = 0. Given that you'd like to pick up every passenger and can only move right, return whether you can pick up and drop off everyone. Constraints n ≤ 100,000 where n is the length of requested_trips
View Solution →Balanced Brackets Sequel - Amazon Top Interview Questions
Given a string s containing round, curly, and square open and closing brackets, return whether the brackets are balanced. Constraints n ≤ 100,000 where n is the length of s Example 1 Input s = "[(])" Output False Example 2 Input s = "([])[]({})" Output True
View Solution →Pairwise Linked List Swap - Amazon Top Interview Questions
Given a singly linked list node, swap each pair of nodes and return the new head. Constraints n ≤ 100,000 where n is the number of nodes in node Example 1 Input node = [0, 1, 3, 4] Output [1, 0, 4, 3] Example 2 Input node = [1, 2, 3] Output [2, 1, 3]
View Solution →