Nvidia interview question goes around: hand-trace the Z-algorithm on a string

cneuralnetwork · x · 2026-10-29

A circulating Nvidia interview question: given s = aaaaaaaabb and a C++ implementation of the Z-function, candidates must state the values of a[1] and a[3] after execution. The code computes the longest common prefix of each position with the string itself, testing whether you can hand-simulate the algorithm step by step.

Original post →

More from Fun

Fun channel →