Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

deleted 9 characters in body
Source Link
Kirill L.
  • 14.3k
  • 2
  • 17
  • 54

R, (削除) 58 (削除ここまで) 55(削除) 55 (削除ここまで) 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.

deleted 1 character in body
Source Link
Kirill L.
  • 14.3k
  • 2
  • 17
  • 54

R, 58(削除) 58 (削除ここまで) 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.

Source Link
Kirill L.
  • 14.3k
  • 2
  • 17
  • 54

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.

AltStyle によって変換されたページ (->オリジナル) /