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 →Reverse Linked List Groups - Amazon Top Interview Questions
Given a singly linked list node, and an integer k, reverse every k contiguous group of nodes. Constraints n ≤ 100,000 where n is the number of nodes in node Example 1 Input node = [0, 1, 2, 3] k = 2 Output [1, 0, 3, 2] Example 2 Input node = [0, 1, 2, 3] k = 3 Output [2, 1, 0, 3]
View Solution →Merging K Sorted Lists - Amazon Top Interview Questions
Given a list of sorted lists of integers, merge them into one large sorted list. Constraints 0 ≤ n * m ≤ 100,000 where n is number of rows and m is the longest column in lists Example 1 Input lists = [ [], [], [10, 12], [], [3, 3, 13], [3], [10], [0, 7] ] Output [0, 3, 3, 3, 7, 10, 10, 12, 13]
View Solution →Subtree - Amazon Top Interview Questions
You are given two binary trees root, and target. Return whether target is a subtree of root — that is, whether there's a node in root that is identically same in values and structure as root including all of its descendants. Example 1 Input root = [1, [2, null, null], [3, [4, [6, null, null], null], [5, null, [7, null, null]]]] target = [3, [4, [6, null, null], null], [5, null, [7, null, null]]] Output True Example 2 Input root = [1, [2, null, null], [3, [4, [6, null, nu
View Solution →