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 8, (削除) 80 (削除ここまで)(削除) 69 (削除ここまで)(削除) 67 (削除ここまで)(削除) 66 (削除ここまで)(削除) 65 (削除ここまで)(削除) 64 (削除ここまで) 63 bytes

Java 8, (削除) 80 (削除ここまで)(削除) 69 (削除ここまで)(削除) 67 (削除ここまで)(削除) 66 (削除ここまで)(削除) 65 (削除ここまで)(削除) 64 (削除ここまで) 63 bytes

(a,b,l)->{for(;l-->0;)if(a[l]>=b[l])b[l]=a[l]*(a[l]>b[l]?1:2);}

Modifies the second input-array instead or returning a new float-array to save bytes.

-11 bytes by taking the length as additional integer-input, which is allowed according to the challenge rules.
-5 bytes thanks to @OliverGrégoire (one byte at a time.. xD)
-1 byte indirectly thanks to @Shaggy's JS answer, by using a[l]*2 instead of a[l]+b[l].

Explanation:

Try it here.

(a,b,l)->{ // Method with 2 float-array and integer parameters and no return-type
 for(;l-->0;) // Loop over the array
 if(a[l]>=b[l]) // If the current value in `a` is larger or equal to `b`:
 b[l]= // Modify the second input-array:
 a[l]* // Use `a` multiplied by:
 (a[l]>b[l]? // If the current value in `a` is larger than `b`:
 1 // Multiply by 1
 : // Else (`a` is smaller of equal to `b`):
 2) // Multiply by 2
 // End of loop (implicit / single-line body)
} // End of method

#Java 8, (削除) 80 (削除ここまで)(削除) 69 (削除ここまで)(削除) 67 (削除ここまで)(削除) 66 (削除ここまで)(削除) 65 (削除ここまで)(削除) 64 (削除ここまで) 63 bytes

(a,b,l)->{for(;l-->0;)if(a[l]>=b[l])b[l]=a[l]*(a[l]>b[l]?1:2);}

Modifies the second input-array instead or returning a new float-array to save bytes.

-11 bytes by taking the length as additional integer-input, which is allowed according to the challenge rules.
-5 bytes thanks to @OliverGrégoire (one byte at a time.. xD)
-1 byte indirectly thanks to @Shaggy's JS answer, by using a[l]*2 instead of a[l]+b[l].

Explanation:

Try it here.

(a,b,l)->{ // Method with 2 float-array and integer parameters and no return-type
 for(;l-->0;) // Loop over the array
 if(a[l]>=b[l]) // If the current value in `a` is larger or equal to `b`:
 b[l]= // Modify the second input-array:
 a[l]* // Use `a` multiplied by:
 (a[l]>b[l]? // If the current value in `a` is larger than `b`:
 1 // Multiply by 1
 : // Else (`a` is smaller of equal to `b`):
 2) // Multiply by 2
 // End of loop (implicit / single-line body)
} // End of method

Java 8, (削除) 80 (削除ここまで)(削除) 69 (削除ここまで)(削除) 67 (削除ここまで)(削除) 66 (削除ここまで)(削除) 65 (削除ここまで)(削除) 64 (削除ここまで) 63 bytes

(a,b,l)->{for(;l-->0;)if(a[l]>=b[l])b[l]=a[l]*(a[l]>b[l]?1:2);}

Modifies the second input-array instead or returning a new float-array to save bytes.

-11 bytes by taking the length as additional integer-input, which is allowed according to the challenge rules.
-5 bytes thanks to @OliverGrégoire (one byte at a time.. xD)
-1 byte indirectly thanks to @Shaggy's JS answer, by using a[l]*2 instead of a[l]+b[l].

Explanation:

Try it here.

(a,b,l)->{ // Method with 2 float-array and integer parameters and no return-type
 for(;l-->0;) // Loop over the array
 if(a[l]>=b[l]) // If the current value in `a` is larger or equal to `b`:
 b[l]= // Modify the second input-array:
 a[l]* // Use `a` multiplied by:
 (a[l]>b[l]? // If the current value in `a` is larger than `b`:
 1 // Multiply by 1
 : // Else (`a` is smaller of equal to `b`):
 2) // Multiply by 2
 // End of loop (implicit / single-line body)
} // End of method
deleted 26 characters in body
Source Link
Kevin Cruijssen
  • 136.2k
  • 14
  • 154
  • 394

#Java 8, (削除) 80 (削除ここまで) (削除) 69 (削除ここまで) (削除) 67 (削除ここまで) (削除) 66 (削除ここまで) (削除) 65 (削除ここまで) 64(削除) 64 (削除ここまで) 63 bytes

(a,b,l)->{for(;l-->0;b[l]=a[l]<b[l]?b[l]:a[l]*>0;)if(a[l]>=b[l])b[l]=a[l]*(a[l]>b[l]?1:2));}

Modifies the second input-array instead or returning a new float-array to save bytes.

-11 bytes by taking the length as additional integer-input, which is allowed according to the challenge rules.
-45 bytes thanks to @OliverGrégoire (one byte at a time.. xD).
-1 byte indirectly thanks to @Shaggy's JS answer, by using a[l]*2 instead of a[l]+b[l].

Explanation:

Try it here. Try it here.

(a,b,l)->{ // Method with two2 float-array and integer parameters and no return-type
 for(;l-->0;) // Loop over the array
 b[l]=  // Modify the second input-array:
 a[l]<b[l]?  if(a[l]>=b[l]) // If the current value in `a` is smallerlarger thanor equal to `b`:
 b[l]b[l]= // Use `b`
 :a[l]>b[l]? // Modify the second Elseinput-array:
 a[l]* // Use `a` multiplied by:
 (a[l]>b[l]? // If the current value in `a` is larger than `b`:
 1 // Multiply by 1
 : // Else (`a` is smaller of equal to `b`):
 2) // Multiply by 2
 ); // End of loop (implicit / single-line body)
} // End of method

#Java 8, (削除) 80 (削除ここまで) (削除) 69 (削除ここまで) (削除) 67 (削除ここまで) (削除) 66 (削除ここまで) (削除) 65 (削除ここまで) 64 bytes

(a,b,l)->{for(;l-->0;b[l]=a[l]<b[l]?b[l]:a[l]*(a[l]>b[l]?1:2));}

Modifies the second input-array instead or returning a new float-array to save bytes.

-11 bytes by taking the length as additional integer-input, which is allowed according to the challenge rules.
-4 bytes thanks to @OliverGrégoire (one byte at a time xD).
-1 byte indirectly thanks to @Shaggy's JS answer, by using a[l]*2 instead of a[l]+b[l].

Explanation:

Try it here.

(a,b,l)->{ // Method with two float-array and integer parameters and no return-type
 for(;l-->0; // Loop over the array
 b[l]=  // Modify the second input-array:
 a[l]<b[l]?  // If the current value in `a` is smaller than `b`:
 b[l] // Use `b`
 :a[l]>b[l]? //  Else:
 a[l]* // Use `a` multiplied by:
 (a[l]>b[l]? // If the current value in `a` is larger than `b`:
 1 // Multiply by 1
 : // Else (`a` is smaller of equal to `b`):
 2) // Multiply by 2
 ); // End of loop
} // End of method

#Java 8, (削除) 80 (削除ここまで) (削除) 69 (削除ここまで) (削除) 67 (削除ここまで) (削除) 66 (削除ここまで) (削除) 65 (削除ここまで) (削除) 64 (削除ここまで) 63 bytes

(a,b,l)->{for(;l-->0;)if(a[l]>=b[l])b[l]=a[l]*(a[l]>b[l]?1:2);}

Modifies the second input-array instead or returning a new float-array to save bytes.

-11 bytes by taking the length as additional integer-input, which is allowed according to the challenge rules.
-5 bytes thanks to @OliverGrégoire (one byte at a time.. xD)
-1 byte indirectly thanks to @Shaggy's JS answer, by using a[l]*2 instead of a[l]+b[l].

Explanation:

Try it here.

(a,b,l)->{ // Method with 2 float-array and integer parameters and no return-type
 for(;l-->0;) // Loop over the array
 if(a[l]>=b[l]) // If the current value in `a` is larger or equal to `b`:
 b[l]= // Modify the second input-array:
 a[l]* // Use `a` multiplied by:
 (a[l]>b[l]? // If the current value in `a` is larger than `b`:
 1 // Multiply by 1
 : // Else (`a` is smaller of equal to `b`):
 2) // Multiply by 2
 // End of loop (implicit / single-line body)
} // End of method
added 126 characters in body
Source Link
Kevin Cruijssen
  • 136.2k
  • 14
  • 154
  • 394

#Java 8, (削除) 80 (削除ここまで) (削除) 69 (削除ここまで) (削除) 67 (削除ここまで) (削除) 66 (削除ここまで) 65(削除) 65 (削除ここまで) 64 bytes

(a,b,l)->{for(;l-->0;b[l]=a[l]<b[l]?b[l]:a[l]*(a[l]>b[l]?a[l]1:a[l]*22));}

Modifies the second input-array instead or returning a new float-array to save bytes.

-11 bytes by taking the length as additional integer-input, which is allowed according to the challenge rules.
-34 bytes thanks to @OliverGrégoire (one byte at a time xD).
-1 byte indirectly thanks to @Shaggy's JS answer, by using a[l]*2 instead of a[l]+b[l].

Explanation:

Try it here. Try it here.

(a,b,l)->{ // Method with two float-array and integer parameters and no return-type
 for(;l-->0; // Loop over the array
 b[l]= // Modify the second input-array:
 a[l]<b[l]? // If the current value in `a` is smaller than `b`:
 b[l] // useUse `b`
 :a[l]>b[l]? // Else-if:
 a[l]* // Use `a` multiplied by:
  (a[l]>b[l]? // If the current value in `a` is larger than `b`:
 a[l] 1  // use `a` Multiply by 1
 : :  // Else (both`a` areis equalssmaller of equal to `b`):
 a[l]*2 2) // Use// `a` times 2 (instead of `a+b`) toMultiply saveby bytes2
 ); // End of loop
} // End of method

#Java 8, (削除) 80 (削除ここまで) (削除) 69 (削除ここまで) (削除) 67 (削除ここまで) (削除) 66 (削除ここまで) 65 bytes

(a,b,l)->{for(;l-->0;b[l]=a[l]<b[l]?b[l]:a[l]>b[l]?a[l]:a[l]*2);}

Modifies the second input-array instead or returning a new float-array to save bytes.

-11 bytes by taking the length as additional integer-input, which is allowed according to the challenge rules.
-3 bytes thanks to @OliverGrégoire.
-1 byte indirectly thanks to @Shaggy's JS answer, by using a[l]*2 instead of a[l]+b[l].

Explanation:

Try it here.

(a,b,l)->{ // Method with two float-array and integer parameters and no return-type
 for(;l-->0; // Loop over the array
 b[l]= // Modify the second input-array:
 a[l]<b[l]? // If the current value in `a` is smaller than `b`:
 b[l] // use `b`
 :a[l]>b[l]? // Else-if the current value in `a` is larger than `b`:
 a[l] // use `a`
 : // Else (both are equals)
 a[l]*2 // Use `a` times 2 (instead of `a+b`) to save bytes
 ); // End of loop
} // End of method

#Java 8, (削除) 80 (削除ここまで) (削除) 69 (削除ここまで) (削除) 67 (削除ここまで) (削除) 66 (削除ここまで) (削除) 65 (削除ここまで) 64 bytes

(a,b,l)->{for(;l-->0;b[l]=a[l]<b[l]?b[l]:a[l]*(a[l]>b[l]?1:2));}

Modifies the second input-array instead or returning a new float-array to save bytes.

-11 bytes by taking the length as additional integer-input, which is allowed according to the challenge rules.
-4 bytes thanks to @OliverGrégoire (one byte at a time xD).
-1 byte indirectly thanks to @Shaggy's JS answer, by using a[l]*2 instead of a[l]+b[l].

Explanation:

Try it here.

(a,b,l)->{ // Method with two float-array and integer parameters and no return-type
 for(;l-->0; // Loop over the array
 b[l]= // Modify the second input-array:
 a[l]<b[l]? // If the current value in `a` is smaller than `b`:
 b[l] // Use `b`
 :a[l]>b[l]? // Else:
 a[l]* // Use `a` multiplied by:
  (a[l]>b[l]? // If the current value in `a` is larger than `b`:
  1  //  Multiply by 1
 :  // Else (`a` is smaller of equal to `b`):
 2) // Multiply by 2
 ); // End of loop
} // End of method
deleted 197 characters in body
Source Link
Kevin Cruijssen
  • 136.2k
  • 14
  • 154
  • 394
Loading
added 9 characters in body
Source Link
Kevin Cruijssen
  • 136.2k
  • 14
  • 154
  • 394
Loading
deleted 20 characters in body
Source Link
Kevin Cruijssen
  • 136.2k
  • 14
  • 154
  • 394
Loading
deleted 20 characters in body
Source Link
Kevin Cruijssen
  • 136.2k
  • 14
  • 154
  • 394
Loading
Source Link
Kevin Cruijssen
  • 136.2k
  • 14
  • 154
  • 394
Loading

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