This question evaluates understanding of tree algorithms (LCA using parent pointers) and selection algorithms (sorting, max-heap, quickselect), emphasizing data structures, algorithmic correctness, and time/space complexity within the Coding & Algorithms domain.

Part A — LCA with parent pointers: You are given two nodes a and b in a rooted tree where each node has a parent pointer (you may or may not have direct access to the root). Design and implement lowestCommonAncestor(a, b) that returns their lowest common ancestor without modifying the nodes. Aim for O(h) time and O(
Part B — Return k closest points: You are given an array of n 2D integer points and an integer k (1 ≤ k ≤ n). Return any order of the k points closest to the origin by Euclidean distance (you may compare squared distances). Tasks: