You are given a sequence of words as a sentence. Reverse the order of all words except the first and last word, and return the modified sentence.
Explanation: Reversing the middle words 'dog runs quickly' results in 'quickly runs dog'.
Analyze constraints and compute optimal solutions step-by-step.
No dry run loaded.
🚀 Practice this problem
Run code, get AI hints & track streak