← NVIDIA Interview Insights

NVIDIA·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Jun 2026

Summary

NVIDIA software engineer technical screen, one coding question the whole time. Pretty focused session, just a tree traversal problem with a specific implementation constraint.

Questions Asked (1)

Q1

Given an in-memory file system represented as a tree (each node has a name, a boolean indicating if it's a file, and a list of children), write a function that returns all full paths to files using DFS.

Algorithms & Data Structures
Author's notes

The structure itself wasn't hard to parse but I second-guessed the path-building part for longer than I should have.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the node structure and path format, then outline a recursive DFS that builds paths from root to leaves. Emphasize that you only add a path when the node is a file, and discuss complexity and edge cases.

Pro tip: Mention that you can avoid string concatenation overhead by passing a mutable path list and joining only at file nodes, which shows performance awareness for large file systems.

1. Clarify the problem

Confirm the node structure (name, isFile, children) and the expected path format (e.g., '/dir/file.txt'). Ask about edge cases like empty tree or root being a file.

2. Choose traversal and path building

Use recursive DFS. Maintain a current path as a list of names; at each node, append the node's name, and if it's a file, join the path into a string and add to results.

3. Implement the DFS

Write a helper function that takes the node and current path. Iterate over children, recurse, and backtrack by removing the last path component after processing.

4. Analyze complexity and edge cases

State time complexity O(N) where N is number of nodes, and space O(H) for recursion stack plus output. Discuss handling of empty tree, root as file, and deep recursion.

5. Test with examples

Walk through a small example tree to verify paths are correct and no duplicates. Mention potential follow-ups like iterative DFS or handling symlinks.

Key Points to Mention

  • Recursive DFS with backtracking to build paths efficiently
  • Only add paths for nodes where isFile is true
  • Use a list for current path and join at file nodes to avoid repeated string concatenation
  • Time complexity O(N) and space complexity O(H) for recursion stack
  • Edge cases: empty tree, root is a file, deep recursion causing stack overflow
  • Path format: use '/' as separator and ensure no trailing slash

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.