Find start node of the cycle in a linked list
Given a linked list containing a cycle, return the starting node of the cycle without modifying the list. Report if there are no cycles in the linked list.
Ace your Coding Interview
Get hired by top tech companies with our comprehensive interview preparation.
Get StartedGiven a linked list containing a cycle, return the starting node of the cycle without modifying the list. Report if there are no cycles in the linked list.
Given a linked list, remove all nodes from it that match a given key.
Given a linked list, construct a complete binary tree from it. Assume that the order of elements present in the linked list is the same as that in the complete tree’s array representation.
Given two height-balanced binary search trees, in-place merge them into a single balanced binary search tree. For each node of a height-balanced tree, the difference between its left and right subtree height is at most 1.
Given a linked list containing a loop, remove the loop from it.
Given two binary trees, check whether the leaf traversals of both trees are the same or not.
Given a binary tree, extract all its leaves into a doubly-linked list, i.e., remove all leaf nodes from the binary tree and construct a doubly linked list out of them.
Given two linked lists, where the tail of the second list points to a node in the first list, find the node where both lists intersect.
Write an efficient algorithm to reverse the specified portion of a given linked list.
Given a linked list with each node having an additional random pointer that points to any random node of the linked list or null, update the random pointer in each linked list node to point to a node with maximum value to their right.
Write an efficient code to clone a linked list with each node containing an additional random pointer. The random pointer can point to any random node of the linked list or null.
Given a binary search tree (BST), efficiently convert it into a min-heap. In order words, convert a binary search tree into a complete binary tree where each node has a higher value than its parent’s value.