Algorithm · ByteDance · Medium
Two short exercises on mutating standard data structures in place: stripping one node out of a singly linked list, and removing one node from a binary tree while leaving a properly formed tree behind. Assume the usual definitions — a list node exposes val and next, a tree node exposes val, left, and right. Task A — Delete the N-th node counted from the tail of a linked list You are given the head of a singly linked list together with a positive integer n. Detach the node…
Checking your access…