Skip to content

Instantly share code, notes, and snippets.

@vivekteega
Created January 6, 2022 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vivekteega/d52c487c9022384b3066573faef6c2e8 to your computer and use it in GitHub Desktop.
Save vivekteega/d52c487c9022384b3066573faef6c2e8 to your computer and use it in GitHub Desktop.
Task for Divyansh
Sort out the input list ending with special character according to the following weights if the symbols
Weight of the symbols
@ - 3
* - 2
# - 1
$ - 0
Input
['abc#','def*','ghi@','jkl$','mno:','pqr#']
Output
['ghi@','def*','abc#''jkl$','mno:','pqr#']
* Sorting should be done for list sets before and after the : keyword
* If a special word repeats, maintain original order
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment