Many of the software engineer questions reported at BNSF are set on the railroad itself: trains competing for station tracks, a consist checked car by car against hazardous-material rules, a freight rate quote that waits on slower services, and readings taken from wheels as trains run. Among the coding problems, only a cache with least-recently-used eviction and a pair-sum lookup show up in plain textbook form. The four practice sets below follow the bank's weight, and an original rail problem is worked in full after them. Every question sits on the BNSF software engineer question page, and the candidate interview accounts describe how the rounds went for the people who reported them.
Rail vocabulary over familiar problem shapes
The railroad setting changes the words in a prompt more often than the computer science underneath. A schedule of arrivals and departures in which each train holds a track while it is in the station is an interval problem. A row of cars that must satisfy placement rules is a sequence you scan while carrying some state. A quote endpoint that depends on other services is ordinary backend code with latency in the way. Once you can name the shape, let the domain supply your clarifying questions.
Algorithm problems carry the most weight, and the onsite ones are set on the railroad. A group filed under software engineering fundamentals asks for production-style code written to a requirement. System design splits between message delivery and wheel sensors, and the behavioral questions match the topics one candidate heard in a first-round call.
What the rail setting asks of you is precision about physical facts. A track holds one train at a time. A car has exactly one position in a consist, and the consist in one prompt is listed from the front of the train to the back. A wheel sits on one car, and that car can travel in many different trains over a month. Say facts like these out loud when you restate a prompt and confirm them, because each one settles a tie, a boundary or a key in your data model.
The assessment, the screens and a four-interview day, as candidates tell it
Candidate accounts describe parts of the process. They do not add up to one fixed loop, so read each as one person's experience.
- One candidate remembers the online assessment only vaguely, as a medium greedy problem about airplane seats. Assessment questions on this page include a car-removal problem built around a two-car bridge and a small REST API that comes with a test-writing task.
- In that candidate's first round, the interviewer spent a long time introducing herself and then invited the candidate's questions. She asked two behavioral questions, one about a deadline and one about onboarding new people or mentoring. The account was written with five back-to-back rounds still to come.
- A second candidate describes a one-hour technical screen in two halves, first writing a program and then design. The task arrived as a markdown requirements document for a REST endpoint that quotes a price for rail freight, with other services it depends on and database access involved.
- A senior candidate had four one-hour interviews on the same day, with about fifteen minutes between them. The first was a walk through the architecture of a system the candidate had worked on. The second was an algorithms round that the candidate compared to Meeting Rooms II, set around trains.
Two practical points follow. Practice writing reviewable code to a written spec inside an hour, as one screen required. Keep one system of your own ready to draw and defend, since one onsite day opened with it.
Station tracks, shared equipment and a two-car bridge
The station and shared-equipment problems are rail problems first: the number of tracks a station needs for a schedule of trains, and the most valid trains you can assemble when equipment is shared. Both were reported from onsite rounds, and the shared-equipment problem is rated hard. A third problem, from an online assessment, asks for the fewest cars to remove for a two-car bridge.
Begin each one by pinning down the model in a sentence or two, then confirm it with a tiny example. For the scheduling problem, ask whether a train leaving at a given minute frees its track for one arriving that same minute. That single tie rule changes the answer on many inputs, so state your assumption and turn it into a test. For the shared-equipment problem, find out what makes one train valid and whether a piece of equipment can serve two trains at once. Until both are settled you cannot choose between a greedy pass, a search over the answer and a matching model. For the bridge problem, write the rule as a condition you can check on any stretch of the sequence, then ask whether removing a car can create a new violation among the cars that close up around the gap. If it can, a one-pass greedy needs an argument before you commit to it.
Present the solution in a fixed order: a brute force in one or two sentences with its cost, the complexity you are aiming for, the idea that gets you there, then code. Name things in the domain's words (tracks_needed, consist, car_index) so the code reads like the prompt, and keep input parsing apart from the core function, so a follow-up that changes the input format does not force a rewrite.
Common follow-ups for problems of this kind are easy to rehearse without the exact wording: return the assignment itself (which track each train uses, which cars come off) along with the count, accept trains one at a time, grow the input until your first data structure stops fitting, or add an exception to a rule. Practice saying what changes in your solution for each before writing new code.
Code from a written spec: a text API, a freight quote, hazmat placement
This family looks least like a whiteboard round. Each question hands you a requirement and asks for working code against it, so write it the way you would for a code review. An online assessment task asks for create, read, update and delete on a simple text resource whose request bodies are plain text instead of JSON, along with tests. A screen question asks for the service layer behind a rail freight quote and then how it holds up when the services it calls are slow; one candidate's account of a screen like it describes the requirements arriving as a markdown document. An onsite question asks you to check the order of a train's cars against hazardous-material placement rules.
Read the whole requirement before typing. Then write down the contract (routes or method signatures, inputs, outputs and every error case), the pieces you will keep apart (request handling, business logic, storage or outside clients) and the first tests you will write.
For the text API, the plain-text body is the detail that catches people. Decide what an empty body means, what happens when a client sends JSON or some other content type anyway, and which status code each path returns. State each decision before you code it and make it a test, including the unhappy paths: reading or deleting something that does not exist, or updating with a bad body. Keep storage behind a small interface so the logic can be tested without a database, and use your framework's test client so the route tests run without starting a server. Be ready to say what would change if two clients update the same item at once.
For the freight quote, separate the code that computes a price from the code that calls out for the inputs to that price. Put each dependency behind an interface so the pricing logic can be tested with fakes; that seam is also where the slow-dependency discussion starts. Then ask the questions that decide the design: which call is slow and how slow, whether a quote may use data that is minutes or hours old, whether the caller needs the answer within the same request, and what the customer sees if a dependency times out. Each answer rules some tools in and others out. Reason through that out loud before naming any of them.
For the hazmat validator, treat rules as data. A long chain of if statements is hard to extend when a follow-up adds a rule, while a small interface per rule (take the consist and the hazardous-material data, return any violations with car positions) lets you add one without touching the rest. Ask whether the caller wants a yes-or-no answer or every violation, whether positions count from zero or one at the front, how to treat a car carrying more than one hazardous material, and what to do with a car the hazardous-material data does not mention. Include a test consist that breaks two rules at once.
Good follow-ups to rehearse for this family are about running the code for real: persistence and concurrent writes for the API, retries and partial failure for the quote, and very long trains for the validator.
Duplicate notifications, read receipts and wheel health
Most of the design questions are about getting messages to people. One asks you to bring separate notification services together without anyone receiving the same notification twice. The other asks for a messenger backend that tells the sender whether each message is still sending, has been delivered or has been read. Another asks for a system that collects measurements from train wheels, flags the damaged ones and forecasts which wheels are heading toward failure. The message questions came from technical screens and the wheel question from an onsite round.
The two message problems share a core decision: where a message gets its identity and where a duplicate is recognized. Make that decision explicit and defend it, because retries, reconnects and a migration between services all produce copies. For the notification question, treat the merge as partly a migration. Plan how traffic moves from the old senders to the new path, and what stops a notification going out twice during the cutover or after a retry, or not going out at all. If you say exactly once, name the component that makes it true and what it costs.
For the status question, draw the life of one message as a small state machine and say who triggers each transition: the server accepting it, the recipient's device confirming receipt, the recipient opening the conversation. Then decide how the sender learns of each change, what happens when the recipient is offline or signed in on two devices, and whether a read can arrive before its delivery confirmation. The prompt leaves scale and group chats open, so set your own numbers and say what a group conversation would change about how statuses are stored.
For wheel health, start with identity and time. Every reading must be tied to one wheel on one car at one moment, and that car may be in a different train next week, so decide how readings are matched to equipment. Then split the system by how fast each part must respond. A reading that signals a severe defect needs to reach a person quickly, while trend analysis and the prediction model can run over each wheel's history at a slower pace. The prompt leaves sensors, scale and response times open, so put numbers on them yourself. Spend real time on the people at the end: who receives an alert, how a false alarm is handled, and how a wheel that has been repaired or replaced starts a fresh history.
For senior loops, also keep the system walk-through from the candidate accounts above ready: one system with real trade-offs that you can draw in under five minutes.
Two stories and two classics from the technical screens
The questions in this section all come from technical screens. Two are behavioral: a deadline that was in danger of slipping, and onboarding or mentoring a new teammate. These are the same two topics one candidate reports from a first-round call. The other two are textbook coding problems: a fixed-capacity cache that evicts whatever was used least recently, and finding two positions in an array whose values add up to a target.
For the deadline story, pick a case with concrete stakes, such as a release tied to a customer date or a dependency on another team. Show the trade you made: scope you cut, help you pulled in, or a risk you raised early and to whom. End with the outcome as a date or a number, plus one thing you would now do sooner. Since the topic can be worded several ways, check that the same story still works if you are asked about a deadline you missed or a date you pushed back on.
For the mentoring story, describe where the new teammate started, what you set up for them in the first weeks (a starter task, pairing sessions, a map of the systems and their vocabulary) and the signal that told you they no longer needed you, such as a first change they shipped alone or a review they led. Keep the focus on the other person's progress. A story that is mostly about your own workload answers a different question.
Bring a few real questions about the team and its systems, since the first-round call in the accounts above made time for them.
For the cache, state the cost you want for each operation before you choose structures, then test the cases that break careless versions: a capacity of one, a put that overwrites a key already present, and a get that should refresh how recently a key was used. For the pair-sum problem, settle the edge cases out loud: duplicates in the array, whether one element may be used twice, what to return when several pairs work, and how your approach changes if the array is sorted or too large to fit in memory.
Worked from scratch: a speed profile from overlapping slow orders
This problem was written for this guide and is not one of the BNSF questions. It sits in the same domain and uses the habits the sections above describe.
A subdivision runs from milepost 0 to milepost L at a normal track speed S. Dispatchers issue temporary speed restrictions, called slow orders, each covering a range of mileposts with a limit in miles per hour, and the ranges may overlap. Return the speed profile a train should follow: consecutive segments covering the whole line, each carrying the lowest limit in force there, with neighboring segments of equal speed merged.
Clarify first. Mileposts are given to a tenth of a mile, so store them as integer tenths (milepost 12.3 becomes 123) and keep floating point out of the boundaries. Ranges include their start and exclude their end, so an order ending at milepost 50 and one starting at 50 touch without overlapping. An order faster than track speed changes nothing. An order that runs past either end of the line is clipped, and a zero-length order is ignored. Ask about each of these before assuming; the tie at a shared milepost is the same kind of rule as the tie at a shared minute in the station problem.
The brute force collects every range boundary, sorts them, and for each gap between neighboring boundaries scans all orders for the lowest limit covering it. With n orders that is O(n^2) time, fine for a handful of orders and slow for a system-wide feed with thousands.
The better approach is a sweep. Turn each order into a start event and an end event, sort the events by milepost, and walk the gaps between consecutive event positions while keeping the active limits in a min-heap. A heap cannot cheaply delete an arbitrary value, so delete lazily: count how many times each limit has ended, and before reading the top, pop it while its ended count is positive. The speed for the current gap is the heap top, or track speed when the heap is empty, and a new segment starts only when that speed changes.
import heapq
from collections import Counter
def speed_profile(line_end, track_speed, orders):
"""orders holds (start, end, limit) tuples in tenths of a milepost; end is exclusive."""
events = []
for start, end, limit in orders:
start, end = max(start, 0), min(end, line_end)
if end > start and track_speed > limit:
events.append((start, 1, limit))
events.append((end, -1, limit))
events.sort()
points = sorted({0, line_end} | {event[0] for event in events})
heap, ended, profile, i = [], Counter(), [], 0
for left, right in zip(points, points[1:]):
while i != len(events):
pos, kind, limit = events[i]
if pos != left:
break
if kind == 1:
heapq.heappush(heap, limit)
else:
ended[limit] += 1
i += 1
while heap and ended[heap[0]]:
ended[heap[0]] -= 1
heapq.heappop(heap)
speed = heap[0] if heap else track_speed
last = profile[-1] if profile else None
if last and last[2] == speed:
last[1] = right
else:
profile.append([left, right, speed])
return profile
Trace it before you call it done. On a 100-mile line with track speed 60, take three orders: 40 mph from milepost 10 to 30, 25 mph from 20 to 25, and a second 40 mph order from 25 to 40. The profile is 60 up to milepost 10, 40 up to 20, 25 up to 25, 40 up to 40, and 60 to the end. At milepost 25 one order ends as another begins, and handling every event at a position before reading the speed is what makes that boundary right. At milepost 30 the first 40 mph order ends while the second holds the same limit, so the merge step keeps a single segment.
Sorting costs O(n log n). Each limit is pushed once and popped at most once, so the sweep is also O(n log n), with O(n) extra space.
For tests, no orders should give one segment at track speed, and one order covering the whole line should give one segment at its limit. Nested orders, touching orders with equal limits, an order above track speed and an order running past the end of the line each get a case. Add a large random test that compares the sweep against the brute force.
Then rehearse the follow-ups. The best one is the length of the train: a train has to hold the restricted speed until its rear end clears the range, so in the profile for the head end each order stretches forward by the train's length. That domain fact changes the input and leaves the algorithm alone. Orders that start and expire at set times add a time dimension to each event. Many lookups of the limit at a single milepost call for building the profile once and binary searching it. Orders added and lifted all day mean either rebuilding on each change or keeping a segment tree over the compressed mileposts, and you should say which and why.
Three weeks across the four BNSF sets
Week one is algorithms. Work the BNSF station-track, shared-equipment and bridge problems untimed first: restate each as the classic shape underneath, write its tie and boundary rules, and list tests before any code. Then solve them again in forty minutes each with one follow-up apiece. Finish with the two coding classics from the screen-round set at twenty minutes each, and the slow-orders problem above from a blank file.
Week two is spec-driven code and design. Build the text API with tests inside one hour in a framework you know well, since one candidate's screen fit code and design into a single hour. Write the freight quote service with its dependencies behind interfaces, then talk through the slow-dependency questions aloud for twenty-five minutes. Build the hazmat validator with one object per rule. Give each question in the BNSF message delivery and wheel-health set its own day, drawing the identity decision and state machine first for the message problems, and putting numbers on readings and alert speed before any boxes for wheel health.
Week three is people and stamina. Write the deadline and mentoring stories and say each aloud in about two minutes. Prepare a fifteen-minute walk-through of a system you built, with one diagram. Then run one mock day of four one-hour sessions with short breaks, the format the senior account describes. Open with a system walk-through and an algorithm problem, the two rounds that account names, then fill the last two sessions with a spec-driven coding task and a design question from the sets above. Use the last two days to redo whatever went worst.
How rail-themed and spec-driven answers fall short
- Spending ten minutes on rail detail that does not affect the algorithm while missing the one fact that does, such as a departure and an arrival in the same minute.
- Whiteboard habits on the spec-driven tasks: one long function, no tests, no error paths and status codes picked without a reason.
- Reaching for a cache the moment a dependency is slow, without asking whether a stale price is acceptable, or listing retries, queues and timeouts without saying which problem each one solves.
- Claiming exactly-once delivery without naming the component that enforces it, or catching duplicates only on the receiving device.
- Starting the wheel-health design with the prediction model, before saying how a reading is tied to a wheel or who acts on an alert.
- Treating the two classics as free points, then shipping a cache that forgets to refresh recency on a get or a pair-sum answer that uses one element twice.
- A deadline story with no stakes and no result.