Pergunta de entrevista da empresa Morgan Stanley

Find out last occurrence of the target in a sorted array.