Reported July 2025
Virtu Financialmath

HexSpeak

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

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

Virtu Financial reported this one in July 2025, and the input size is the first thing to read: values go up to 10^12, so the string won't fit in a 32-bit int. Parse it into a 64-bit integer and brute force never enters the picture. It's HexSpeak, a plain base conversion with a character check. Easy on paper, but the overflow trap and the 0/1 replacement order catch people who rush. If you blank on the live OA, StealthCoder runs invisibly as a safety net. Here's the script before you need it.

The problem

You are given a string s that encodes a decimal integer. Convert that integer to its uppercase hexadecimal representation.
Then replace every 0 with O and every 1 with I. The result is a valid HexSpeak word only if every character belongs to A, B, C, D, E, F, I, or O.
Return the HexSpeak word if it is valid. Otherwise, return "ERROR".

Function
toHexspeak(s: String) → String

Examples
Example 1
s = "257"
return = "IOI"
The decimal number 257 is 101 in hexadecimal. Replacing 1 with I and 0 with O gives "IOI".
Example 2
s = "3"
return = "ERROR"
The decimal number 3 is 3 in hexadecimal. Since 3 is not a valid HexSpeak character, return "ERROR".

Constraints
1 <= value(s) <= 10^12
s is a valid decimal representation of an integer in this range.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The trick is that there's no trick, just clean execution. Parse s into a 64-bit integer, since 10^12 overflows a 32-bit int. Convert to uppercase hex by repeated division by 16, or use the built-in formatter. Then walk each character. Map 0 to O and 1 to I. If the character is A through F, keep it. Anything else (digits 2 through 9) means you return "ERROR". The common pitfall is overflow in languages with 32-bit ints, followed by forgetting uppercase. Another is replacing digits after the check in a way that lets bad digits through. Do it in one pass: map or reject per character. Complexity is O(log n) time, about 10 hex digits at most. If the live OA has you freezing on the details, StealthCoder is the hedge that reads the problem and gives you the working solution.

The honest play: practice the pattern, and have StealthCoder ready for the one you didn't see coming.

If this hits your live OA

You can drill HexSpeak 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 for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play.

Get StealthCoder

Related leaked OAs

⏵ Practice the LeetCode equivalent

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

⏵ The honest play

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

Virtu Financial reuses patterns across OAs. Built for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play. Works on HackerRank, CodeSignal, CoderPad, and Karat.

HexSpeak FAQ

How hard is the Virtu Financial HexSpeak question really?+

Easy. It's base conversion plus a character filter. The only real risks are integer overflow on values up to 10^12 and sloppy handling of the 0 and 1 replacements. If you can convert to hex by hand, you can solve it in a few minutes.

What's the trick to HexSpeak?+

Use a 64-bit integer, convert to uppercase hex, then check each character in one pass. Map 0 to O, 1 to I, keep A-F, and return ERROR on anything else. There's no deeper algorithm hiding in it.

Why does the input come as a string?+

Because the value can reach 10^12, which overflows a 32-bit int. Parse it into a long or equivalent type. In Python it doesn't matter, but in Java, C++, or Go you need the wider type to avoid wrong answers.

What edge cases should I test?+

Test the smallest value 1, which gives I. Test a value like 3, which must return ERROR. Test 10^12 for overflow. Test a value whose hex contains only letters, like 255 giving FF. Also confirm lowercase letters never leak into the output.

How do I prepare for this in 48 hours?+

Practice writing hex conversion by hand with a division loop and a digit lookup, in your OA language. Then solve it once with built-in formatting. Know both versions. Spend the rest of your time on other string and math basics, since this problem is quick.

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

OA at Virtu Financial?
Invisible during screen share
Get it