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

edited body
Source Link
Galen Ivanov
  • 21.5k
  • 3
  • 26
  • 62
 ┌─────┬─────┐
 1 23 -> │0 1 2│2 3 4│
 └─────┴─────┘
 ┌─────┬─────┐
 1 2 -> │0 1 2│2 3 4│
 └─────┴─────┘
 ┌─────┬─────┐
 1 3 -> │0 1 2│2 3 4│
 └─────┴─────┘
Fit all code in one line
Source Link
Galen Ivanov
  • 21.5k
  • 3
  • 26
  • 62

A naïve and verbose solution in J. It is a straightforward implementtionimplementation of the task.

m=.{;~1 3 5
(+/^:_"2((,&.>/@(<:,],>:)"0)&.>m){0 m}a)m(m=.{;~1 3 5)}a=.>:?7 79ドル

Try it online! Try it online!

A naïve and verbose solution in J. It is a straightforward implementtion of the task.

m=.{;~1 3 5
(+/^:_"2((,&.>/@(<:,],>:)"0)&.>m){0 m}a)m}a=.>:?7 79ドル

Try it online!

A naïve and verbose solution in J. It is a straightforward implementation of the task.

(+/^:_"2((,&.>/@(<:,],>:)"0)&.>m){0 m}a)(m=.{;~1 3 5)}a=.>:?7 79ドル

Try it online!

added 15 characters in body
Source Link
Galen Ivanov
  • 21.5k
  • 3
  • 26
  • 62

J, 67(削除) 67 (削除ここまで) 65 bytes

A naïve and verbose solution in J. It is a straightforward implementationimplementtion of the task.

s=m=.{;~1 3 5
(+/^:_"2((,&.>/@(<:,],>:)"0)&.>m=.{;~1 3 5
(+/^:_"2 s>m){0 m}a)m}a=.>:?7 79ドル
 ┌─────┬─────┐
 1 32 -> │0 1 2│2 3 4│
 └─────┴─────┘

Try it online! Try it online!

J, 67 bytes

A naïve and verbose solution in J. It is a straightforward implementation of the task.

s=.(,&.>/@(<:,],>:)"0)&.>m=.{;~1 3 5
(+/^:_"2 s{0 m}a)m}a=.>:?7 79ドル
 ┌─────┬─────┐
 1 3 -> │0 1 2│2 3 4│
 └─────┴─────┘

Try it online!

J, (削除) 67 (削除ここまで) 65 bytes

A naïve and verbose solution in J. It is a straightforward implementtion of the task.

m=.{;~1 3 5
(+/^:_"2((,&.>/@(<:,],>:)"0)&.>m){0 m}a)m}a=.>:?7 79ドル
 ┌─────┬─────┐
 1 2 -> │0 1 2│2 3 4│
 └─────┴─────┘

Try it online!

edited body
Source Link
Galen Ivanov
  • 21.5k
  • 3
  • 26
  • 62
Loading
added 1 character in body
Source Link
Galen Ivanov
  • 21.5k
  • 3
  • 26
  • 62
Loading
Source Link
Galen Ivanov
  • 21.5k
  • 3
  • 26
  • 62
Loading

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