DSA interview question
This is the letter version of the inverted triangle: the first row holds the first n letters of the alphabet, and every row after it drops the last letter, until only A remains. It combines the shrinking row length from Pattern 5 with the character arithmetic from Pattern 14, so it's a quick check that you can mix a shape rule with a value rule without mixing them up.
Example for n = 5:
ABCDE
ABCD
ABC
AB
A
vector<string> reverseLetterTriangle(int n); // row i: the first n - i + 1 letters
Input n | Output rows | Explanation |
|---|---|---|
| 1 | "A" | |
| 3 | "ABC", "AB", "A" | Each row drops its last letter |
| 5 | "ABCDE", "ABCD", "ABC", "AB", "A" |
(Confirm: 1 ≤ n ≤ 26; letters without separators.)
On Practick another engineer interviews you live for 60 minutes on a question from this bank. They have the full interviewer guide beside the call: the expected answer to every follow-up, hints to give if you stall, and a scoring rubric. You get the model solution once the session settles. It is free: interview someone for an hour and you have earned your own.
Book a free mock interviewAll 474 dsa interview questions
DSA mock interviews · System design interview questions · Free mock interview practice · Browse interviewers · Sign in