Reported September 2026
Capital Onegraph

Reconstruct Landmark Journey

Reported by candidates from Capital One's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Capital One OA. Under 2s to a working solution.
Founder's read

Capital One reported this one in September 2026, and the trap is hiding in plain sight. Reconstruct Landmark Journey hands you unordered pairs and asks for a single path through them. It looks like a graph problem because it is one, but the solution is simpler than a full traversal. If you've got an OA invite and 48 hours, learn the one detail about the endpoints and you're mostly there. If you blank during the live assessment, StealthCoder sits invisibly on your screen as a safety net and reads the problem for you.

The problem

A traveler visited a series of unique landmarks on a journey. Unfortunately, their travel journal was damaged, and they can no longer remember the exact order of their visits. However, they do have a collection of photos, each showing exactly two landmarks that were visited consecutively. Either landmark could have been visited first.
Given the collection of photos represented as pairs of landmark IDs in travelPhotos, help the traveler reconstruct the complete journey. Each landmark was visited exactly once, and for every consecutive pair of landmarks in the journey, there exists a photo containing both landmarks.
You may reconstruct the journey in either forward or reverse order; both are considered correct.

Function
solution(travelPhotos: int[][]) → int[]

Examples
Example 1
travelPhotos = [[3, 5], [1, 4], [2, 4], [1, 5]]
return = [3, 5, 1, 4, 2]
The photos show that landmarks 3 and 5 were visited consecutively, as were 1 and 4, 2 and 4, and 1 and 5.
The journey [3, 5, 1, 4, 2] contains each of those consecutive landmark pairs.

Reported by candidates. Source: FastPrep

Pattern and pitfall

Treat each landmark as a node and each photo as an undirected edge. Since every landmark is visited once and consecutive ones share a photo, the graph is a single simple path. Build an adjacency map. The start is the node with exactly one neighbor. That's the edge case that breaks naive solutions: people pick an arbitrary node and walk, which fails unless they begin at an endpoint. From the start, walk forward and track the previous node so you never step backward. Each step moves to the neighbor that isn't the one you came from. Stop when you've used all nodes. Watch the tiny input: a single photo gives two nodes, both with degree one, and either order is valid. Complexity is O(n) time and space. If the live OA freezes your brain, StealthCoder is the hedge that gives you the walk quickly.

The honest play: practice the pattern, and have StealthCoder ready for the one you didn't see coming.

If this hits your live OA

You can drill Reconstruct Landmark Journey cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play.

Get StealthCoder

Related leaked OAs

⏵ Practice the LeetCode equivalent

This OA pattern shows up on LeetCode as restore the array from adjacent pairs. If you have time before the OA, drill that.

⏵ The honest play

You've seen the question. Make sure you actually pass Capital One's OA.

Capital One reuses patterns across OAs. Built for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Reconstruct Landmark Journey FAQ

What's the trick in Reconstruct Landmark Journey?+

Model photos as undirected edges. The journey is a simple path, so exactly two nodes have degree one. Start at either one and walk, never returning to the node you just left. That gives the full order in linear time with no backtracking needed.

How hard is this problem really?+

It's easy to medium. No fancy algorithm is needed. The difficulty is realizing you must start at an endpoint, not a random node. Once you see the path structure, the code is about fifteen lines with a hash map of neighbors.

Do I need DFS or can I just loop?+

A simple loop works. Keep a current node and a previous node. Each iteration, pick the neighbor of current that isn't previous. DFS also works but recursion depth could grow with long journeys, so iteration is safer.

What edge cases should I test?+

Test a single photo, which gives two landmarks and either order is valid. Test input where the pairs are listed in scrambled order, like the example. Also check that landmark IDs aren't contiguous, so use a hash map rather than an array index.

How do I prepare in 48 hours for a Capital One OA like this?+

Practice building adjacency maps from edge lists and walking paths and chains. Write this solution from scratch twice. Then review related graph basics like degree counting and visited tracking. Focus on clean handling of small inputs rather than memorizing many problems.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Capital One.

OA at Capital One?
Invisible during screen share
Get it