Grids, Graphs & the In-Memory File System
- Model an in-memory file system as a tree and find every path that carries a given name
- Find the shortest path on a 0/1 grid with BFS, including a blocked start and start equal to target
- Switch to Dijkstra or 0-1 BFS when the cost of a step depends on its direction
- Talk through approach, pseudocode and complexity before you code, the way the round runs
Graphs and grids are the newest algorithm shapes in Disney's live coding. A Bengaluru Senior Product Engineer 1 loop in November 2026 opened its DSA round with an in-memory file system, built and searched with BFS and DFS. In September 2026 a Product Software Engineer II candidate in India got a grid shortest path with obstacles, where a step cost more or less depending on which way it went. The same grid with plain one-cost steps came up in 2025, at a phone screen and again at an onsite.
None of it is exotic. A senior on the Disney Experiences side said in March 2026 that the live round was one medium tree problem and one medium graph problem, and called both pretty easy. Disney engineers in 2026 put the coding bar at LeetCode easy to medium. So the points go to clean, working code and a clear explanation of it.
Java is the language in most recent Disney backend reports, so every solution below comes in Java first, with a Python version after it. Each problem runs in the editor with its own tests.
How the Disney DSA round runs
The clearest example is a September 2026 Product Software Engineer II loop in India. Round one was a 60-minute DSA round on a grid shortest path. The discussion covered edge cases, time and space, and possible optimizations, and the candidate's advice afterwards was to know when BFS, Dijkstra or 0-1 BFS fits. That loop's other technical round was on .NET and C#, a reminder that the stack follows the team. For most backend roles it's Java.
The November 2026 Bengaluru loop put the file system first. A PR review with a US interviewer came next, then a hiring manager round and a behavioral round. The DSA round was a file system kept in memory as a graph, with paths built and searched by BFS and DFS, and file and folder names that repeat across directories.
The family also turns up without names. The March 2026 Disney Experiences senior loop had a medium tree problem and a medium graph problem. Back in 2022, a Disney Streaming frontend loop gave one candidate a DFS graph problem, while a friend interviewing for the same role got FizzBuzz.
Pick the traversal by what a step costs. When every step costs the same, BFS finds the shortest path, because it reaches cells in order of distance. When steps cost 0 or 1, a deque does the same job with free steps pushed to the front. Any other non-negative costs call for Dijkstra and a priority queue. A file system is a tree, so a plain BFS or DFS visits each node once.
In-memory file system with duplicate names
Something like this opened the Bengaluru Senior Product Engineer 1 loop in November 2026, as round one. The candidate described a graph-backed file system in memory, paths built and searched with BFS and DFS, and duplicate file and folder names. The class below keeps the operations of the classic in-memory file system and adds a search by name. Your interviewer's methods may differ, so practice the shape.
In-Memory File System With Duplicate Names
Problem
FileSystem that lives in memory. It starts with only the root folder /, and every path is absolute, like /docs/notes.Use
mkdir(path) to create a folder and any missing parents. A call to write(path, content) creates a file, making parent folders as needed, and appends content if the file already exists. Reading with read(path) returns a file's content. Listing with ls(path) returns the sorted names inside a folder, or a one-item list with the file's own name when path is a file.find(name) returns the full path of every file and folder whose own name equals name. The same name can sit in many folders, and a file and a folder can share it. Return shallower paths first and paths at the same depth in sorted order, comparing them folder by folder. Return an empty list when nothing matches.You can assume every call is valid.
read and ls only get paths that exist, and nothing writes to a folder's path.- FileSystem()
- mkdir("/docs/notes")
- write("/work/notes", "draft")
- write("/docs/notes/notes", "todo")
- find("notes")→ ["/docs/notes","/work/notes","/docs/notes/notes"]
- ls("/work/notes")→ ["notes"]
notes is a folder under docs, a file under work, and a file inside that docs folder. All three come back, the two at depth two first.
Store each folder as a sorted map from child name to child node. To search, run BFS from the root carrying each node's full path, and compare every child's own name with the target.
In-Memory File System With Duplicate Names
Click "Run" to execute your code
find in O(1) and breaks the first time notes exists in two folders, because the second entry overwrites the first. A tree of child maps keys every node by its parent and its name, which is exactly what a path means. Let the search build each path as it walks. Name the trade-off as you pick the traversal: BFS returns the shallowest matches first, while DFS holds only one branch in memory at a time.find limited to one folder, or matches listed in depth-first order. Resolve the folder with the same walk helper, then recurse into its children in sorted order, passing the path so far. Each subtree's matches then come out together. If links between folders get added, the tree becomes a graph that can loop, so keep a visited set of nodes.Grid shortest path with obstacles
This one has the longest record of the three. In 2025 it came up in a Disney software engineer phone screen as a medium BFS problem, and again in an onsite next to a game leaderboard design. Both had a 0/1 grid, four-way moves and -1 when the target can't be reached. The follow-ups covered complexity, start equal to target, a blocked start or end, large grids and, as an option, diagonal moves. The September 2026 round built on the same grid, so get the plain version solid first.
Grid Shortest Path With Obstacles
Problem
start cell and a target cell given as [row, col]. Each step moves one cell up, down, left or right, onto an open cell inside the grid.Return the fewest steps from
start to target, or -1 if no path exists. If either cell is a wall, return -1. If they're the same open cell, the answer is 0.Grids can be large, so keep the work linear in the number of cells.
The walls in the middle row force the path along the top, down the right side and back along the bottom.
BFS from the start. Every step costs the same, so the first time BFS reaches the target it has used the fewest steps. Mark a cell as seen when you queue it.
Grid Shortest Path With Obstacles
Click "Run" to execute your code
Grid path with direction costs
In September 2026 a Product Software Engineer II candidate in India got a 60-minute DSA round on a grid shortest path with obstacles, where moving cost different amounts depending on the direction. The skill being tested is knowing when BFS, Dijkstra or 0-1 BFS fits. Something like the problem below, with one price per direction, covers that ground. On LeetCode the closest match is problem 1368, a grid where following a cell's arrow is free and changing it costs 1, which is the 0-1 case.
Grid Path With Direction Costs
Problem
costs is [up, down, left, right], four non-negative integers, and a step in a direction costs that amount.Return the cheapest total cost from
start to target, or -1 when the target can't be reached or either cell is a wall. Staying where you are costs 0. The cheapest path may take more steps than the shortest one.The fewest-steps route climbs to the top row and costs 10 over 6 steps. Going right, down the far side and left along the bottom takes 8 steps and costs 8, since it never moves up.
Run Dijkstra with a min-heap of (cost so far, row, col). Pop the cheapest cell, skip it if a cheaper cost is already recorded, and relax its four neighbors with the cost of that direction.
Grid Path With Direction Costs
Click "Run" to execute your code
Disney coding interview questions
Does Disney ask LeetCode questions?
Yes, mostly at the easy to medium level. Disney engineers in 2026 said to expect LeetCode easy or medium, one panelist put frontend at easy at most, and one software engineer said they got no LeetCode at all. The named problems from 2025 and 2026 include graph and grid problems like these and an LRU cache. Teams set their own loops, so the mix depends on the org.
Which language should I use?
Java, if the role is backend and you're at home in it. It's named in the Spring Boot builds, the Java-only set problem and a live Java OOP round on HackerRank, all from 2025 or 2026. One 2026 India Product Software Engineer II loop was .NET and C# instead. Frontend roles code in JavaScript or TypeScript, and data roles in Python and SQL.
How long is the Disney DSA round?
In the September 2026 India loop it was booked for 60 minutes. The candidate went from approach to pseudocode, complexity, code and follow-ups, finished in about 40 minutes, and was done at about 45. For the rest of the loop, see The Disney Interview Process.
Key Takeaways
- ✓Disney's newest named DSA problems are graphs and grids, from a file system searched with BFS and DFS to grid shortest paths.
- ✓Key file system nodes by their parent folder and name. A map from name to path loses every duplicate.
- ✓BFS counts steps. When steps have prices, use Dijkstra, or a 0-1 BFS deque when every price is 0 or 1.
- ✓Talk through approach, pseudocode and complexity before you code. The September 2026 round followed that order.
Disney interview guideKnow what Disney asks before you walk in.
27 coding · 6 system design · 16 behavioral questions
Get their questions first.
InterviewLegend is independent and not affiliated with or endorsed by any company it covers.