Reported August 2026
HSBCstring

Remove Vowels from a String

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

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

The mistake that sinks a first attempt on this HSBC OA, reported in August 2026, is forgetting uppercase vowels. The problem is simple: strip a, e, i, o, u from a string and return what's left. It's a plain string filter, and the traps are small ones. If you've got the OA in a day or two, this is one of the easy ones, so don't overthink it. Get the vowel set right, handle the empty string, and you're done. StealthCoder sits invisibly on your screen as a safety net if your mind goes blank on the live assessment, but you probably won't need it here.

The problem

The vowels of the English alphabet are (a, e, i, o, u, A, E, I, O, U). Write an algorithm to eliminate all vowels from a given string.
Input
The first line consists of a string.
Print a string that excludes all the vowels of the given input string.
Note
The vowels of the English alphabet are (a, e, i, o, u, A, E, I, O, U).
The input string contains English letters only.

Function
removeVowel(engStr: String) → String

Examples
Example 1
engStr = "haveaniceday"
return = "hvncdy"
The output string is “hvncdy”.

Constraints
0 ≤ len ≤ 100; where len is length of the input string.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The pattern is a single pass over the string. Build a set of the ten vowels, both cases: a, e, i, o, u, A, E, I, O, U. Walk each character, keep it if it's not in the set, and join the kept characters into the result. That's O(n) time and O(n) space for the output. The common pitfall is checking only lowercase vowels, which fails on any input with capitals. The second is the edge case: length can be 0, so an empty string must return an empty string without crashing. Don't use repeated string concatenation in languages where that's slow, though at length 100 it won't matter. You can also lowercase each character before the check, which is cleaner than listing ten letters. If you blank on the live OA, StealthCoder can hand you the filter loop fast, but the logic is short enough to write from memory.

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 Remove Vowels from 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 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

⏵ The honest play

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

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

Remove Vowels from a String FAQ

How hard is the HSBC remove vowels question really?+

It's easy. One pass, one set lookup per character. The length cap is 100, so performance is irrelevant. The only way to fail is sloppy details like missing uppercase vowels or mishandling an empty input. Write it carefully and test two or three cases.

What's the trick to removing vowels from a string?+

There isn't a deep trick. Put all ten vowels, upper and lower, in a set. Loop over the characters and keep anything not in the set. Alternatively, lowercase each character for the check only, and append the original character so capitals in consonants stay intact.

What edge cases should I test before submitting?+

Test an empty string, a string that's all vowels (should return empty), a string with no vowels (should return unchanged), and mixed case like 'AbEcI'. The constraints say letters only, so you don't need to handle digits or punctuation, but keeping them unchanged is harmless.

Do I need to worry about the function signature?+

Yes. The function is removeVowel taking engStr and returning a string. Return the result, don't print it, unless the platform's template says otherwise. Match the name and casing exactly, since a mismatch can fail every test even with correct logic.

How do I prepare for this in 48 hours?+

Don't spend long on this one. Write the set-filter solution once in your language, then spend your time on harder string and array problems that might show up alongside it. A few minutes of practice with character loops and joins is enough for this question.

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

OA at HSBC?
Invisible during screen share
Get it