Tag: data structure
Given a linked list, swap every two adjacent nodes and return its head. You may not modify the values in the list’s nodes. Only nodes itself may be changed. …
This is the technical phone interview question from Google. Google has offices in London but the call was from Google Switzerland (+41). The interview lasts for 45 minutes. Given …
We have talked about the Pre-order in this post, and In-order Traversal for binary tree in this post. And this article talks about the third kind: Postorder traversal, which …
Reverse a linked list from position m to n. For example: Given 1-2-3-4-5-NULL, m = 2 and n = 4, return 1-4-3-2-5-NULL. 1 ≤ m ≤ n ≤ length …
Remove the nth node from the end of a singly linked list and return its head. For example, input: 1-2-3-4-5, and n = 2. Removing the second node from …