Question: need help solving this in java An online shop sells T-shirts of three sizes: S (small), M (medium) and L (large). Write a function solution
need help solving this in java
An online shop sells T-shirts of three sizes: S (small), M (medium) and L (large). Write a function solution that, given a string T of length N containing letters S, M and L, returns a sorted string T by T-shirt sizes from the smallest to the largest. Examples: 1. Given T = "MSSLS", the function should return "SSSML". 2. Given T = "LLMS", the function should return "SMLL". 3. Given T = "SMS", the function should return "SSM". Write an efficient algorithm for the following assumptions: N is an integer within the range (1..200,000): string T consists only of the following characters: "s", "M" and/or "L
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
