Reported February 2024
Googlestring

Time to Type a String

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

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

Google's Time to Type a String hit candidates in February 2024, and it looks deceptively simple until you realize you're building a timing simulation. You've got a keyboard, you're moving between keys, and you need to calculate the total time to type out a full string. The trap is thinking this is just about counting characters. It's not. You're tracking position and distance. StealthCoder can spot the state variables you need if you blank on setup.

Pattern and pitfall

The problem is a string simulation wrapped in a distance calculation. You start at some position (usually 'A'), then for each character in the target string, you calculate the Manhattan distance to reach it, add a fixed keypress time, and move your cursor forward. Common mistakes: forgetting to update your current position after each keystroke, hardcoding coordinates wrong, or not realizing the optimal path between two keys is just the absolute difference. The pattern is straightforward string traversal with state management, but the implementation detail around position tracking trips people up in real time. StealthCoder handles the bookkeeping if you freeze.

If this hits your live OA and you blank, StealthCoder solves it in seconds, invisible to the proctor.

If this hits your live OA

You can drill Time to Type 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. Built by an Amazon engineer who would have shipped this the night before his JPMorgan OA if he'd had it.

Get StealthCoder

Related leaked OAs

⏵ The honest play

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

Google reuses patterns across OAs. Built by an Amazon engineer who would have shipped this the night before his JPMorgan OA if he'd had it. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Time to Type a String FAQ

Is this just finding the Manhattan distance between letters?+

Yes, but you're doing it repeatedly. You move from your current position to the target character, add distance plus a fixed keypress delay, then update your position. Loop through every character in the string. The trick is not forgetting to move your cursor after each key.

Where do I start on the keyboard?+

The problem will specify. Usually you start at 'A'. Check the problem text carefully. That starting position matters because it affects the first character's distance cost.

Does the keyboard layout matter?+

If it's a standard QWERTY layout, you map each letter to (row, col) coordinates. Uppercase and lowercase are the same key. If the problem describes a different layout, parse it and build your coordinate map first.

What's the trap that makes this fail in the live OA?+

Forgetting to add the fixed keypress time per character, or miscalculating distance because you forgot to update your position between keys. Write out a small example by hand first to lock in the pattern before coding.

Is this a common Google OA question?+

String simulation and state tracking show up often. This flavor (movement plus timing) is straightforward but detail-heavy. If you handle position and distance cleanly, you're golden. Off-by-one errors are the enemy.

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

OA at Google?
Invisible during screen share
Get it