Reported September 2026
Nvidiatwo pointers

Reverse A String

Reported by candidates from Nvidia's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Nvidia OA. Under 2s to a working solution.
Founder's read

The data structure here is just a string, but how you handle it decides whether this Nvidia OA question from September 2026 is a freebie or a silent bug. Reverse a string of up to 10^5 printable ASCII characters. It's a two-pointers warmup, and the trap is in the details, not the idea. If your mind goes blank on a problem this simple, it happens more than people admit. StealthCoder sits invisibly on your screen during the live OA as a safety net, so one freeze doesn't cost you the round. Still, you should be able to write this in under two minutes.

The problem

You are given a string s consisting of printable ASCII characters.
Return a new string whose characters are the characters of s in reverse order.
The empty string reverses to the empty string.

Function
reverseString(s: String) → String

Examples
Example 1
s = "hello"
return = "olleh"
Reading hello from right to left produces olleh.
Example 2
s = "a"
return = "a"
A single character is already reversed.

Constraints
0 <= s.length <= 10^5.
s contains only printable ASCII characters.

Reported by candidates. Source: FastPrep

Pattern and pitfall

Convert the string to a character array, put one pointer at index 0 and another at the last index, swap, move both inward, stop when they cross. That's O(n) time. The pitfall is language-specific. In Java, Python, and JavaScript, strings are immutable, so repeated concatenation in a loop can drag you toward O(n^2) at 10^5 characters. Build with an array or builder, then join once. Handle the empty string and the single character without special-casing, because the pointers already cross immediately. Don't reach for recursion either, since depth of 10^5 can overflow the stack. Slicing tricks or a built-in reverse are fine if the assessment allows them, but write the two-pointer version if you want to show your work. If you blank mid-assessment, StealthCoder can hand you the clean swap loop in real time.

Drill it cold or hedge it with StealthCoder. Either way, don't walk into the OA hoping you remember the trick.

If this hits your live OA

You can drill Reverse A String cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Made for the candidate who got the OA invite this morning and has 72 hours, not six months.

Get StealthCoder

Related leaked OAs

⏵ Practice the LeetCode equivalent

This OA pattern shows up on LeetCode as reverse string. If you have time before the OA, drill that.

⏵ The honest play

You've seen the question. Make sure you actually pass Nvidia's OA.

Nvidia reuses patterns across OAs. Made for the candidate who got the OA invite this morning and has 72 hours, not six months. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Reverse A String FAQ

How hard is the Nvidia Reverse A String question really?+

It's easy. The logic is a swap loop with two pointers. Reported in September 2026, it looks like a warmup. The only way to lose points is sloppy handling of immutable strings, off-by-one pointer bounds, or a quadratic concatenation on a 10^5-length input.

What's the trick to solving it?+

Use two pointers, left at the start and right at the end. Swap the characters, move inward, and stop when left is no longer less than right. Work on a mutable array of characters, then join it back into a string once at the end.

Do I need to handle the empty string?+

Yes, but you don't need special code. With length 0, the right pointer starts at -1, so left is not less than right and the loop never runs. Return the empty string. A single character behaves the same way and comes back unchanged.

Will string concatenation time out on 10^5 characters?+

It can. In languages with immutable strings, appending character by character may copy the string each time, giving O(n^2) work. Collect characters in a list or builder and join once. That keeps the whole thing linear and safe at the upper constraint.

How do I prepare for this in 48 hours?+

Write the two-pointer reverse in your main language until you can do it from memory, including the empty and one-character cases. Then spend the rest of your time on harder two-pointer and string problems, since a question this easy usually isn't the whole assessment.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Nvidia.

OA at Nvidia?
Invisible during screen share
Get it