Tag Archives: Lexicographical

Sort strings in Lexicographical order

You are given n strings. You have to print them in lexicographical increasing order. Also, ensure that all of the strings should be distinct. Examples: Input: {“Aarav”, “Arjun”, “Rahul”, “Rishabh”, “Kunal”} Output: {“Aarav”, “Arjun”, “Kunal”, “Rahul”, “Rishabh”} Input: {“Vikram”, “Rajat”, “Abhishek”, “Suresh”, “Rajat”} Output: {“Abhishek”, “Rajat”, “Suresh”, “Vikram”} Recommended: What is Algorithm | Introduction to Algorithms Approach: Actually… Read More »