Dsa
Strings
Warm-up
Reversing Words
You are given a sentence consisting of words separated by spaces. Your task is to reverse the order of the words in the sentence. Ensure that there is a single space between words in the output.
Example Input:
Hello world this is a test
Example Output:
test a is this world Hello
Key concepts
stringsreversaltokenization
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now