Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
3 deleted 9 characters in body
source | link

R, 58 5555 45 bytes

b=seq(a<-scana=scan());while(any(b-a)a[2]>2)a=matrix(a,,2,F<-F+1);F

Try it online!Try it online!

Simulates the sorting process. Input is 1-indexed, returns FALSE for 0.

R, 58 55 bytes

b=seq(a<-scan());while(any(b-a))a=matrix(a,,2,F<-F+1);F

Try it online!

Simulates the sorting process. Input is 1-indexed, returns FALSE for 0.

R, 58 55 45 bytes

a=scan();while(a[2]>2)a=matrix(a,,2,F<-F+1);F

Try it online!

Simulates the sorting process. Input is 1-indexed, returns FALSE for 0.

2 deleted 1 character in body
source | link

R, 5858 55 bytes

b=seq(a<-scan());while(any(b-a))a=matrix(a,,2,F<-F+1)[b];F;F

Try it online!Try it online!

Simulates the sorting process. Input is 1-indexed, returns FALSE for 0.

R, 58 bytes

b=seq(a<-scan());while(any(b-a))a=matrix(a,,2,F<-F+1)[b];F

Try it online!

Simulates the sorting process. Input is 1-indexed, returns FALSE for 0.

R, 58 55 bytes

b=seq(a<-scan());while(any(b-a))a=matrix(a,,2,F<-F+1);F

Try it online!

Simulates the sorting process. Input is 1-indexed, returns FALSE for 0.

1
source | link

R, 58 bytes

b=seq(a<-scan());while(any(b-a))a=matrix(a,,2,F<-F+1)[b];F

Try it online!

Simulates the sorting process. Input is 1-indexed, returns FALSE for 0.