Read the question, write TypeScript on the right, then Run or Check.
QuestionHint and solution stay closed until you open them
Read integers and print them reversed, space-separated.
Input. Space-separated integers.
Output. Reversed list.
Examples
Input
1 2 3
Output
3 2 1
Hint
- [...nums].reverse().join(' ')
Show correct code
Peek only after you have tried. You can still Check your own version.
const nums = readLine().trim().split(/\s+/).filter(Boolean);
console.log([...nums].reverse().join(' '));
main.tstsc · readLine() · Ctrl + Enter
ResultIdle
Run to see output. Check grades the tests.