talgorithm.nim 331 B

12345678910111213141516171819
  1. discard """
  2. output:'''@["3", "2", "1"]
  3. '''
  4. """
  5. #12928,10456
  6. import sequtils, strutils, algorithm, json
  7. proc test() =
  8. try:
  9. let info = parseJson("""
  10. {"a": ["1", "2", "3"]}
  11. """)
  12. let prefixes = info["a"].getElems().mapIt(it.getStr()).sortedByIt(it).reversed()
  13. echo prefixes
  14. except:
  15. discard
  16. test()