Lexicographically Largest String with One Swap

One smart swap can completely change a string. Day 53 of 100 Days DSA Today’s problem was to find the lexicographically largest string possible with at most one swap. The key idea was tracking the largest character on the right side of every position and performing the first swap that increases the string order. A simple observation leads to an efficient O(n) solution. #100DaysOfCode #DSA #Java #CodingJourney #ProblemSolving #AMU #AligarhMuslimUniversity

  • graphical user interface

To view or add a comment, sign in

Explore content categories