Reported August 2024
TikTokstring

Substrings Without Vowels

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

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

TikTok asked this in August and it's a straightforward string filter. You're counting or extracting substrings that contain zero vowels. The trap is overthinking it. Most candidates blow time on edge cases or try to optimize a problem that doesn't need it. If you blank on the approach, StealthCoder will hand you the pattern instantly so you don't crater on a string-iteration problem.

Pattern and pitfall

The core move is iterate through the string and identify maximal contiguous blocks of non-vowel characters. Each block is a candidate pool. From a block of length n, you can form n * (n + 1) / 2 substrings, all of which contain only consonants and non-letter characters. The math is cheap. Most falter because they either try regex, or they manually count substrings instead of using the combinatorial formula. The pattern is sliding window or two-pointer adjacent to the vowel definition check. StealthCoder solves this in seconds if you freeze mid-OA.

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 Substrings Without Vowels 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

⏵ Practice the LeetCode equivalent

This OA pattern shows up on LeetCode as number of substrings containing all three characters. If you have time before the OA, drill that.

⏵ The honest play

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

TikTok 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.

Substrings Without Vowels FAQ

Are spaces and digits considered vowels?+

No. Only a, e, i, o, u (and sometimes uppercase variants, check the problem spec). Everything else, including numbers, spaces, and punctuation, are treated as non-vowel characters and count toward valid substrings.

Do I need to return unique substrings or count duplicates?+

The problem likely asks for a count of all possible substrings (including duplicates). If it asks for unique, you'd need a set. Read the exact output requirement before coding. Don't assume.

What's the time complexity I should aim for?+

O(n) linear scan. You walk through the string once, identify vowel boundaries, and apply the formula n * (n + 1) / 2 for each block. No nested loops. If you're doing nested iteration, you're overcomplicating it.

How do I handle uppercase vowels?+

Check the problem statement. If it mentions case-insensitivity, treat A, E, I, O, U the same as lowercase. Most problems do this, but verify. A single missed vowel type tanks your test cases.

Can I solve this in 48 hours with no prep?+

Yes. It's a string iteration problem, not a data structure beast. Write brute force first, test on examples, then optimize to the formula. If you get stuck, the pattern is always substring enumeration. StealthCoder will confirm your approach in the live OA.

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

OA at TikTok?
Invisible during screen share
Get it