## Rectangular Overlap - Amazon Top Interview Questions

You are given two lists of integers rect0 and rect1 representing coordinates (x0, y0, x1, y1) of two rectangles. (x0, y0) is the bottom left coordinate and (x1, y1) is the upper right coordinate. Return whether the two rectangles overlap. Note: if two rectangles touch only in their perimeters, they don't overlap. Example 1 Input rect0 = [0, 0, 10, 10] rect1 = [10, 10, 30, 30] Output False Example 2 Input rect0 = [0, 0, 10, 10] rect1 = [5, 5, 30, 30] Output T

View Solution →## Repeating String - Amazon Top Interview Questions

Given a lowercase alphabet string s, return whether it's a repeating string. Constraints n ≤ 100,000 where n is the length of s Example 1 Input s = "dogdogdog" Output True Explanation "dog" is repeated. Example 2 Input s = "catdog" Output False

View Solution →## Max Product of Three Numbers - Amazon Top Interview Questions

Given a list of integers nums, find the largest product of three distinct elements. Constraints 3 ≤ n ≤ 100,000 where n is the length of nums Example 1 Input nums = [5, 4, 1, 3, -2, -2] Output 60 Explanation We can multiply 5 * 4 * 3 Example 2 Input nums = [-3, 1, 1, 0] Output 0 Explanation We can multiply 1 * 1 * 0

View Solution →## Verify Max Heap - Amazon Top Interview Questions

Given a list of integers nums, return whether it represents a max heap. That is, for every i we have that: nums[i] ≥ nums[2*i + 1] if 2*i + 1 is within bounds nums[i] ≥ nums[2*i + 2] if 2*i + 2 is within bounds Constraints 0 ≤ n ≤ 100,000 where n is the length of nums Example 1 Input nums = [4, 2, 3, 0, 1] Output True

View Solution →## Matrix Prefix Sum - Amazon Top Interview Questions

Given a two-dimensional integer matrix, return a new matrix A of the same dimensions where each element is set to A[i][j] = sum(matrix[r][c]) for all r ≤ i, c ≤ j. Constraints n, m ≤ 250 where n and m are the number of rows and columns in matrix matrix[i][j] ≤ 2**12 Example 1 Input matrix = [ [2, 3], [5, 7] ] Output [ [2, 5], [7, 17] ]

View Solution →