Given a string array, we have to read, traverse, reverse and sort its elements.
Example:
Input:
arr = ["abc", "pqr", "xyz"]
Output:
String arra is: ["abc", "pqr", "xyz"]
Reversed: ["xyz", "pqr", "abc"]
Sorted (Ascending Order): ["abc", "pqr", "xyz"]
Sorted (Descending Order): ["xyz", "pqr", "abc"]
Program to read, traverse, reverse and sort string array in Kotlin
Output
need an explanation for this answer? contact us directly to get an explanation for this answer