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

Commonmark migration
Source Link

#Java 10, (削除) 72 (削除ここまで) 65 bytes

Java 10, (削除) 72 (削除ここまで) 65 bytes

d->{var r=d.clone();for(int i=54;i-->0;r[i*7%54]=d[i]);return r;}

Similar as @GB's Ruby answer, but by using i*7%54 on the result-array, instead of i*17%54 on the input-array to save a byte.

Try it online.

Explanation:

d->{ // Method with String-array as both parameter and return-type
 var r=d.clone();// Result-String, starting as a copy of the input
 for(int i=54;i-->0;
 // Loop `i` in the range (54, 0]
 r[ // Set an item in the result-array at index:
 i*7%54 // Index `i` multiplied by 7, and then take modulo-54
 ]=d[i]); // To the `i`'th item in the input-Deck
 return r;} // Return the result-Array

#Java 10, (削除) 72 (削除ここまで) 65 bytes

d->{var r=d.clone();for(int i=54;i-->0;r[i*7%54]=d[i]);return r;}

Similar as @GB's Ruby answer, but by using i*7%54 on the result-array, instead of i*17%54 on the input-array to save a byte.

Try it online.

Explanation:

d->{ // Method with String-array as both parameter and return-type
 var r=d.clone();// Result-String, starting as a copy of the input
 for(int i=54;i-->0;
 // Loop `i` in the range (54, 0]
 r[ // Set an item in the result-array at index:
 i*7%54 // Index `i` multiplied by 7, and then take modulo-54
 ]=d[i]); // To the `i`'th item in the input-Deck
 return r;} // Return the result-Array

Java 10, (削除) 72 (削除ここまで) 65 bytes

d->{var r=d.clone();for(int i=54;i-->0;r[i*7%54]=d[i]);return r;}

Similar as @GB's Ruby answer, but by using i*7%54 on the result-array, instead of i*17%54 on the input-array to save a byte.

Try it online.

Explanation:

d->{ // Method with String-array as both parameter and return-type
 var r=d.clone();// Result-String, starting as a copy of the input
 for(int i=54;i-->0;
 // Loop `i` in the range (54, 0]
 r[ // Set an item in the result-array at index:
 i*7%54 // Index `i` multiplied by 7, and then take modulo-54
 ]=d[i]); // To the `i`'th item in the input-Deck
 return r;} // Return the result-Array
added 73 characters in body
Source Link
Kevin Cruijssen
  • 136.2k
  • 14
  • 154
  • 394

#Java 10, (削除) 72 (削除ここまで) 65 bytes bytes

d->{var r=d.clone();for(int i=54;i-->0;r[i*7%54]=d[i]);return r;}

Similar as @GB's Ruby answer, but by using 7i*7%54 on the result-array, instead of 17i*17%54 on the input-array to save a byte.

Try it online.

Explanation:

d->{ // Method with String-array as both parameter and return-type
 var r=d.clone();// Result-String, starting as a copy of the input
 for(int i=54;i-->0;
 // Loop `i` in the range (54, 0]
 r[ // InsertSet an item toin the result-array at index:
 i*7%54 // Index `i` multiplied by 7, and then take modulo-54
 ]=d[i]); // To the `i`'th item in the input-Deck
 return r;} // Return the result-Array

#Java 10, (削除) 72 (削除ここまで) 65 bytes

d->{var r=d.clone();for(int i=54;i-->0;r[i*7%54]=d[i]);return r;}

Similar as @GB's Ruby answer, but by using 7 instead of 17.

Try it online.

Explanation:

d->{ // Method with String-array as both parameter and return-type
 var r=d.clone();// Result-String, starting as a copy of the input
 for(int i=54;i-->0;
 // Loop `i` in the range (54, 0]
 r[ // Insert an item to the result-array at index:
 i*7%54 // Index `i` multiplied by 7, and then take modulo-54
 ]=d[i]); // To the `i`'th item in the input-Deck
 return r;} // Return the result-Array

#Java 10, (削除) 72 (削除ここまで) 65 bytes

d->{var r=d.clone();for(int i=54;i-->0;r[i*7%54]=d[i]);return r;}

Similar as @GB's Ruby answer, but by using i*7%54 on the result-array, instead of i*17%54 on the input-array to save a byte.

Try it online.

Explanation:

d->{ // Method with String-array as both parameter and return-type
 var r=d.clone();// Result-String, starting as a copy of the input
 for(int i=54;i-->0;
 // Loop `i` in the range (54, 0]
 r[ // Set an item in the result-array at index:
 i*7%54 // Index `i` multiplied by 7, and then take modulo-54
 ]=d[i]); // To the `i`'th item in the input-Deck
 return r;} // Return the result-Array
deleted 35 characters in body
Source Link
Kevin Cruijssen
  • 136.2k
  • 14
  • 154
  • 394

#Java 10, 72(削除) 72 (削除ここまで) 65 bytes

d->{var r=d.clone();for(int i=d.length;ii=54;i-->0;r[i*7%54]=d[i]);return r;}

Similar as @GB's Ruby answer, but by using 7 instead of 17.

Try it online. Try it online.

Explanation:

d->{ // Method with String-array as both parameter and return-type
 var r=d.clone();// Result-String, starting as a copy of the input
 for(int i=d.length;ii=54;i-->0;
 // Loop `i` in the range (length_of_input54, 0]
 r[ // Insert an item to the result-array at index:
 i*7%54 // Index `i` multiplied by 7, and then take modulo-54 (Deck-size)
 ]=d[i]); // To the `i`'th item in the input-Deck
 return r;} // Return the result-Array

#Java 10, 72 bytes

d->{var r=d.clone();for(int i=d.length;i-->0;r[i*7%54]=d[i]);return r;}

Similar as @GB's Ruby answer, but by using 7 instead of 17.

Try it online.

Explanation:

d->{ // Method with String-array as both parameter and return-type
 var r=d.clone();// Result-String, starting as a copy of the input
 for(int i=d.length;i-->0;
 // Loop `i` in the range (length_of_input, 0]
 r[ // Insert an item to the result-array at index:
 i*7%54 // Index `i` multiplied by 7, and then take modulo-54 (Deck-size)
 ]=d[i]); // To the `i`'th item in the input-Deck
 return r;} // Return the result-Array

#Java 10, (削除) 72 (削除ここまで) 65 bytes

d->{var r=d.clone();for(int i=54;i-->0;r[i*7%54]=d[i]);return r;}

Similar as @GB's Ruby answer, but by using 7 instead of 17.

Try it online.

Explanation:

d->{ // Method with String-array as both parameter and return-type
 var r=d.clone();// Result-String, starting as a copy of the input
 for(int i=54;i-->0;
 // Loop `i` in the range (54, 0]
 r[ // Insert an item to the result-array at index:
 i*7%54 // Index `i` multiplied by 7, and then take modulo-54
 ]=d[i]); // To the `i`'th item in the input-Deck
 return r;} // Return the result-Array
Post Undeleted by Kevin Cruijssen
deleted 1 character in body
Source Link
Kevin Cruijssen
  • 136.2k
  • 14
  • 154
  • 394
Loading
Post Deleted by Kevin Cruijssen
Source Link
Kevin Cruijssen
  • 136.2k
  • 14
  • 154
  • 394
Loading

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