GlobalLogic interview question

Given a string, write full code of reversing that string word by word. Write full code of sorting an array which consist of only 3 distinct numbers 3,4 and