Reported July 2023
Arcesiumsimulation

Robo Data Sharing Direction

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

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

Arcesium reported this one in July 2023, and it looks scarier than it is. A grid of robots, a priority list for passing data, and a query cell. Strip the story away and it's a snake traversal from a corner. You don't need to simulate every cell if you can reason about rows. If you've got an invite and 48 hours, this is a pure math and direction problem. StealthCoder is there as a safety net if you blank during the live OA, but the logic below should be enough to get you through.

The problem

Robots occupy every cell of a rows by cols matrix. Data starts at one corner, (startRow, startCol), using 1-based coordinates.
After a robot consumes the data, it passes the data to the first adjacent robot that has not consumed it, using this priority:
Right: (row, col + 1).
Left: (row, col - 1).
Front: (row - 1, col).
Back: (row + 1, col).
For the queried robot (row, col), return the direction in which it passes the data. Return Over if it is the final robot to consume the data.

Function
nextDataDirection(rows: int, cols: int, startRow: int, startCol: int, row: int, col: int) → String

Examples
Example 1
rows = 3
cols = 3
startRow = 1
startCol = 1
row = 3
col = 3
return = "Over"
Starting at the top-left corner produces a row-by-row snake traversal. Cell (3, 3) is last.
Example 2
rows = 2
cols = 3
startRow = 1
startCol = 3
row = 2
col = 2
return = "Right"
The first row is traversed right-to-left. After moving down, the second row is traversed left-to-right, so (2, 2) passes data right.

Constraints
rows and cols are positive.
(startRow, startCol) is one of the four corners.
1 <= row <= rows and 1 <= col <= cols.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The trick: the priority order (Right, Left, Front, Back) from a corner forces a boustrophedon path. You sweep a full row in one direction, step down or up, then sweep back the other way. So the answer depends only on the queried row's offset from the start row and on the starting column. Compute the row index k = distance from startRow. Row direction is Right if (startCol is 1 and k is even) or (startCol is cols and k is odd), else Left. If the cell is the end of its row in that direction, the data goes Back when the start is the top (startRow = 1) or Front when the start is the bottom, unless it's the last row, which returns Over. Pitfall: off-by-one with 1-based coordinates, and single-column or single-row grids where the sweep direction is degenerate. Test those. If you freeze live, StealthCoder can cover you, but write the parity rule first.

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 Robo Data Sharing Direction 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

⏵ The honest play

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

Arcesium 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.

Robo Data Sharing Direction FAQ

What's the trick in Robo Data Sharing Direction?+

It's a snake traversal. From a corner, the Right, Left, Front, Back priority makes you sweep each row fully, shift one row, then sweep back. Skip the simulation and use parity of the row distance from the start row plus the starting column side.

Do I need to simulate the whole grid?+

No. Simulation works but it's wasteful. You can answer in constant time by checking the row offset parity, the sweep direction, and whether the queried cell sits at the row's end. Simulating is fine as a fallback if the constraints are small.

What edge cases break this problem?+

Single-row grids, single-column grids, and the final cell returning Over. With one column, there's no horizontal move, so the data goes straight Back or Front. Also watch the 1-based indexing when you compute the offset from the start row.

How does the starting corner change the answer?+

A top start moves down using Back, a bottom start moves up using Front. A left start sweeps Right first, a right start sweeps Left first. Four corners, but they're just mirrors of one rule, so write one function and flip the signs.

How should I prepare for this in 48 hours?+

Hand-trace the two examples, then a 1xN, an Nx1, and a 4x4 from each corner. Write the parity rule on paper. Arcesium reported this in July 2023, so expect grid-walk and direction-logic variants rather than heavy data structures.

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

OA at Arcesium?
Invisible during screen share
Get it