← NVIDIA Interview Insights

NVIDIA·Software Engineer·Technical Phone Screen·Intermediate

IntermediatePrefer not to say
May 2026

Summary

Interviewed for a SWE role at Nvidia, pretty short technical screen. Just one coding question, nothing too wild, but I fumbled around more than I should have for something this basic.

Questions Asked (1)

Q1

Write a function that checks whether a given string contains a specific substring.

Algorithms & Data Structures
Author's notes

Felt almost too easy and that made me second-guess myself.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the problem: confirm whether the function should return a boolean, handle case sensitivity, and consider edge cases like empty strings. Then propose a straightforward solution using a built-in method like `str.find()` or `strstr()`, but also discuss implementing a more efficient algorithm such as KMP for large inputs. Finally, analyze time and space complexity and mention potential optimizations.

Pro tip: Demonstrate awareness of real-world constraints: mention that while built-in functions are often optimal, understanding the underlying algorithm (e.g., KMP) shows depth, especially for NVIDIA where performance matters. Also, proactively discuss handling Unicode or overlapping matches if relevant.

1. Clarify requirements

Ask about return type (boolean vs index), case sensitivity, and whether the substring can be empty. Confirm if the function should handle large strings efficiently.

2. Outline naive approach

Describe a simple solution using built-in methods like `str.find()` or a manual loop, and state its time complexity (O(n*m) worst-case).

3. Propose optimized algorithm

Introduce KMP or Rabin-Karp for O(n+m) time, explaining how it avoids redundant comparisons. Mention when to use each.

4. Analyze complexity and edge cases

Discuss time/space complexity of chosen approach and handle edge cases: empty string, substring longer than string, overlapping occurrences.

5. Code and test

Write clean code with meaningful variable names, and walk through test cases including normal, boundary, and performance scenarios.

Key Points to Mention

  • Built-in methods like `str.find()` or `strstr()` are often sufficient and optimized.
  • Naive approach has O(n*m) time complexity; KMP improves to O(n+m).
  • Edge cases: empty string, substring longer than string, case sensitivity, Unicode.
  • Space-time trade-offs: KMP uses O(m) extra space for the prefix table.
  • Real-world considerations: input size, performance requirements, and language-specific implementations.
  • Testing: include normal, boundary, and large input cases to ensure correctness and efficiency.

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