Starfall Signal Map
Lookouts stationed at the Starfall Pinnacle chart aurora sweeps to guide airships through dark valleys. The chart always begins with one base coordinate, marking the core beacon's projection on the valley floor. A sweep director then announces a series of sky vectors; each vector describes how far a mirrored flare swings east-west and north-south from the core. Cartographers must translate this announcement into the final list of projected coordinates so captains can replay the exact sweep later.
The conversion follows a precise recursive rule. Starting with the base coordinate origin = [x, y], every additional vector [dx, dy] wraps the existing coordinate list: first add a new coordinate [x + dx, y + dy], then copy the entire inner list exactly, next add the mirrored coordinate [x - dx, y - dy], and finally copy the inner list again unchanged. The first vector in the list is closest to the origin, so it wraps before later vectors. When no vectors remain, the chart contains only the origin.
You are given an integer pair origin and an array of integer pairs vectors, ordered from inner to outer sweeps. Return the complete ordered list of coordinates generated by the rule above, where each coordinate is a two-element array. Do not mutate the input values. Captains expect the coordinates in the exact order implied by the recursive definition.
Example 1:
Input: origin = [0,0], vectors = []
Output: [[0,0]]
Example 2:
Input: origin = [0,0], vectors = [[2,1]]
Output: [[2,1], [0,0], [-2,-1], [0,0]]
Example 3:
Input: origin = [1,-1], vectors = [[3,0], [0,2]]
Output: [[4,-1], [1,1], [1,-1], [1,-3], [1,-1], [-2,-1], [1,1], [1,-1], [1,-3], [1,-1]]
Related Problems
No related problems found
Comments (0)
Join the Discussion
Share your thoughts, ask questions, or help others with this problem.
