Microsoft interview question

Write code that reverses words in a string.

Interview Answers

Anonymous

8 Dec 2016

$string = "Write code that reverses words in a string" $words = $string -split " " [array]::Reverse($words) $words -join " "

1

Anonymous

20 Feb 2019

print(string1[::-1])

Anonymous

30 Dec 2016

string.split('').reverse().join('')