Lucid Software Interview Question

first, two questions are related to sorting and string manipulation