Skip to main content
saved another 2 bytes thanks to KevinCruijssen
Source Link
ბიმო
  • 17k
  • 3
  • 43
  • 106

Java, 130 117 114 107107 105 bytes

This is the obvious solution. I don't usually golf in Java, but I was curious to see if Java could beat the Brainfuck version. Doesn't seem like I did a good job then.. Maybe one could use the new Map/Reduce from Java 8 to save some bytes.

Thanks to @flawr (13 bytes), @KevinCruijssen (79 bytes) and @DarrelHoffman (3 bytes)!

Golfed:

double d(float[]a,float[]b){float x=0,s;for(int i=-1;++i<ai=0;i<a.length;s=a[i]-b[i],x+=s*slength;x+=s*s);returns=a[i]-b[i++];return Math.sqrt(x);} 

Ungolfed:

public static double d(float[]afloat[] a,float[]b float[] b) {   float x=0,s;fors; for(int i=-1;++i<ai=0; i<a.length;s=a[i]-b[i],length; x+=s*s);   s = a[i] - b[i++];  return Math.sqrt(x); } 

Java, 130 117 114 107 bytes

This is the obvious solution. I don't usually golf in Java, but I was curious to see if Java could beat the Brainfuck version. Doesn't seem like I did a good job then.. Maybe one could use the new Map/Reduce from Java 8 to save some bytes.

Thanks to @flawr (13 bytes), @KevinCruijssen (7 bytes) and @DarrelHoffman (3 bytes)!

Golfed:

double d(float[]a,float[]b){float x=0,s;for(int i=-1;++i<a.length;s=a[i]-b[i],x+=s*s);return Math.sqrt(x);} 

Ungolfed:

public static double d(float[]a,float[]b){   float x=0,s;for(int i=-1;++i<a.length;s=a[i]-b[i],x+=s*s); return Math.sqrt(x); } 

Java, 130 117 114 107 105 bytes

This is the obvious solution. I don't usually golf in Java, but I was curious to see if Java could beat the Brainfuck version. Doesn't seem like I did a good job then.. Maybe one could use the new Map/Reduce from Java 8 to save some bytes.

Thanks to @flawr (13 bytes), @KevinCruijssen (9 bytes) and @DarrelHoffman (3 bytes)!

Golfed:

double d(float[]a,float[]b){float x=0,s;for(int i=0;i<a.length;x+=s*s)s=a[i]-b[i++];return Math.sqrt(x);} 

Ungolfed:

double d(float[] a, float[] b) { float x=0,s; for(int i=0; i<a.length; x+=s*s)   s = a[i] - b[i++];  return Math.sqrt(x); } 
fixed mentioning user (@Two Words -> @TwoWords)
Source Link
ბიმო
  • 17k
  • 3
  • 43
  • 106

Java, 130 117 114 107 bytes

This is the obvious solution. I don't usually golf in Java, but I was curious to see if Java could beat the Brainfuck version. Doesn't seem like I did a good job then.. Maybe one could use the new Map/Reduce from Java 8 to save some bytes.

Thanks to @flawr (13 bytes), @Kevin Cruijssen@KevinCruijssen (7 bytes) and @DarrelHoffman (3 bytes)!

Golfed:

double d(float[]a,float[]b){float x=0,s;for(int i=-1;++i<a.length;s=a[i]-b[i],x+=s*s);return Math.sqrt(x);} 

Ungolfed:

public static double d(float[]a,float[]b){ float x=0,s;for(int i=-1;++i<a.length;s=a[i]-b[i],x+=s*s); return Math.sqrt(x); } 

Java, 130 117 114 107 bytes

This is the obvious solution. I don't usually golf in Java, but I was curious to see if Java could beat the Brainfuck version. Doesn't seem like I did a good job then.. Maybe one could use the new Map/Reduce from Java 8 to save some bytes.

Thanks to @flawr (13 bytes), @Kevin Cruijssen (7 bytes) and @DarrelHoffman (3 bytes)!

Golfed:

double d(float[]a,float[]b){float x=0,s;for(int i=-1;++i<a.length;s=a[i]-b[i],x+=s*s);return Math.sqrt(x);} 

Ungolfed:

public static double d(float[]a,float[]b){ float x=0,s;for(int i=-1;++i<a.length;s=a[i]-b[i],x+=s*s); return Math.sqrt(x); } 

Java, 130 117 114 107 bytes

This is the obvious solution. I don't usually golf in Java, but I was curious to see if Java could beat the Brainfuck version. Doesn't seem like I did a good job then.. Maybe one could use the new Map/Reduce from Java 8 to save some bytes.

Thanks to @flawr (13 bytes), @KevinCruijssen (7 bytes) and @DarrelHoffman (3 bytes)!

Golfed:

double d(float[]a,float[]b){float x=0,s;for(int i=-1;++i<a.length;s=a[i]-b[i],x+=s*s);return Math.sqrt(x);} 

Ungolfed:

public static double d(float[]a,float[]b){ float x=0,s;for(int i=-1;++i<a.length;s=a[i]-b[i],x+=s*s); return Math.sqrt(x); } 
saved another 7 bytes
Source Link
ბიმო
  • 17k
  • 3
  • 43
  • 106

Java, 130 117 114114 107 bytes

This is the obvious solution. I don't usually golf in Java, but I was curious to see if Java could beat the Brainfuck version. Doesn't seem like I did a good job then.. Maybe one could use the new Map/Reduce from Java 8 to save some bytes.

Thanks to @flawr (13 bytes), @Kevin Cruijssen (7 bytes) and @DarrelHoffman (3 bytes)!

Golfed:

public double d(float[]a,float[]b){float x=0,s;for(int i=-1;++i<a.length;s=a[i]-b[i],x+=s*s);return Math.sqrt(x);} 

Ungolfed:

public static double d(float[]a,float[]b){ float x=0,s;for(int i=-1;++i<a.length;s=a[i]-b[i],x+=s*s); return Math.sqrt(x); } 

Java, 130 117 114 bytes

This is the obvious solution. I don't usually golf in Java, but I was curious to see if Java could beat the Brainfuck version. Doesn't seem like I did a good job then.. Maybe one could use the new Map/Reduce from Java 8 to save some bytes.

Thanks to @flawr (13 bytes) and @DarrelHoffman (3 bytes)!

Golfed:

public double d(float[]a,float[]b){float x=0,s;for(int i=-1;++i<a.length;s=a[i]-b[i],x+=s*s);return Math.sqrt(x);} 

Ungolfed:

public static double d(float[]a,float[]b){ float x=0,s;for(int i=-1;++i<a.length;s=a[i]-b[i],x+=s*s); return Math.sqrt(x); } 

Java, 130 117 114 107 bytes

This is the obvious solution. I don't usually golf in Java, but I was curious to see if Java could beat the Brainfuck version. Doesn't seem like I did a good job then.. Maybe one could use the new Map/Reduce from Java 8 to save some bytes.

Thanks to @flawr (13 bytes), @Kevin Cruijssen (7 bytes) and @DarrelHoffman (3 bytes)!

Golfed:

double d(float[]a,float[]b){float x=0,s;for(int i=-1;++i<a.length;s=a[i]-b[i],x+=s*s);return Math.sqrt(x);} 

Ungolfed:

public static double d(float[]a,float[]b){ float x=0,s;for(int i=-1;++i<a.length;s=a[i]-b[i],x+=s*s); return Math.sqrt(x); } 
cut off 3 bytes
Source Link
ბიმო
  • 17k
  • 3
  • 43
  • 106
Loading
updated code
Source Link
ბიმო
  • 17k
  • 3
  • 43
  • 106
Loading
Source Link
ბიმო
  • 17k
  • 3
  • 43
  • 106
Loading