Zipped String - Amazon Top Interview Questions

Given lowercase alphabet strings a, b, and c return whether there's any way of obtaining c by merging characters in order from a and b. Constraints 0 ≤ n ≤ 1,000 where n is the length of a 0 ≤ m ≤ 1,000 where m is the length of b 0 ≤ k ≤ 1,000 where k is the length of c Example 1 Input a = "abc" b = "def" c = "abdefc" Output True Explanation abdefc is an interleave since abc and def can be interleaved with: abdefc Example 2 Input a = "ab" b = "cd" c = "a

View Solution →

Central Linked List - Amazon Top Interview Questions

Given a singly linked list node, return the value of the middle node. If there's two middle nodes, then return the second one. Bonus: Solve using \mathcal{O}(1)O(1) space. Constraints n ≤ 100,000 where n is the number of nodes in node Example 1 Input node = [0, 1, 2] Output 1

View Solution →