Skip to main content
Commonmark migration
Source Link

#Java 10, 84 74 bytes

Java 10, 84 74 bytes

a->b->{float A=0,B=0;int i=0;for(var t:b){A+=a[i++]*t;B+=t*t;}return A/B;}

Try it online.

#Java 10, 84 74 bytes

a->b->{float A=0,B=0;int i=0;for(var t:b){A+=a[i++]*t;B+=t*t;}return A/B;}

Try it online.

Java 10, 84 74 bytes

a->b->{float A=0,B=0;int i=0;for(var t:b){A+=a[i++]*t;B+=t*t;}return A/B;}

Try it online.

deleted 7 characters in body
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384

#Java 810, 8484 74 bytes

a->b->{float A=0,B=0;forB=0;int i=0;for(intvar i=a.length;i-->0;B+=b[i]*b[i]t:b)A+=a[i]*b[i];return{A+=a[i++]*t;B+=t*t;}return A/B;}

Try it online.Try it online.

#Java 8, 84 bytes

a->b->{float A=0,B=0;for(int i=a.length;i-->0;B+=b[i]*b[i])A+=a[i]*b[i];return A/B;}

Try it online.

#Java 10, 84 74 bytes

a->b->{float A=0,B=0;int i=0;for(var t:b){A+=a[i++]*t;B+=t*t;}return A/B;}

Try it online.

Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384

#Java 8, 84 bytes

a->b->{float A=0,B=0;for(int i=a.length;i-->0;B+=b[i]*b[i])A+=a[i]*b[i];return A/B;}

Try it online.