I don't understand their expected output
I don\'t understand their expected output. \n\n\nInput: s = "rat"\nOutput: "art"\n\nExplanation: The word "rat" becomes "art" after re-ordering it with the ment
I don\'t understand their expected output. \n\n```\nInput: s = "rat"\nOutput: "art"\n```\nExplanation: The word "rat" becomes "art" after re-ordering it with the mentioned algorithm.\n\nI think it should be `arttra`. \n\n1. Pick the smallest character from s and append it to the result.\n1. Pick the smallest character from s which is greater than the last appended character to the result and append it.\n1. Repeat step 2 until you cannot pick more characters.\n1. Pick the largest character from s and append it to the result.\n1. Pick the largest character from s which is smaller than the last appended character to the result and append it.\n1. Repeat step 5 until you cannot pick more characters.\n1. Repeat the steps from 1 to 6 until you pick all characters from s.\n\nAren\'t they skipping step 4? What am I missing?
[]