Skip to main content
added 237 characters in body
Source Link
Dennis
  • 211.7k
  • 41
  • 380
  • 830

J, 8 bytes

-:]/:i.~ 

Test it with J.js.

How it works

-:]/:i.~ Monadic verb. Argument: y (list of digits) i.~ Find the index in y of each d in y. ]/: Sort y by the indices. -: Match; compare the reordering with the original y. 

J, 8 bytes

-:]/:i.~ 

Test it with J.js.

J, 8 bytes

-:]/:i.~ 

Test it with J.js.

How it works

-:]/:i.~ Monadic verb. Argument: y (list of digits) i.~ Find the index in y of each d in y. ]/: Sort y by the indices. -: Match; compare the reordering with the original y. 
Source Link
Dennis
  • 211.7k
  • 41
  • 380
  • 830

J, 8 bytes

-:]/:i.~ 

Test it with J.js.