Hi everyone,
I’m working on a project where I need to sort an array of clothing items in ascending order based on a specific sequence. I have three types of clothing items: shoes, pants, and shirt. I want to arrange them in the following order: shoes, pants, and then shirt.
For example:
- Given the 1D string array: pants, shoes, shirt
The output should be: shoes, pants, shirt
- Given the array: pants, pants, shirt, shoes
The output should be: shoes, pants, pants, shirt
- Given the array: shoes, pants, pants, shirt, shoes
The output should be: shoes, shoes, pants, pants, shirt
I’m looking for a way to sort the array such that the items are ordered according to the specified sequence.
thank you!