Skip to main content
Commonmark migration
Source Link

#Java 8, 82 bytes

Java 8, 82 bytes

a->n->m->{int l=a.length-m-n,r[]=new int[l];System.arraycopy(a,n,r,0,l);return r;}

Try it here.

Alternative with same (82) byte-count using a loop:

(a,n,m)->{int l=a.length-m,r[]=new int[l-n],i=0;for(;n<l;r[i++]=a[n++]);return r;}

Try it here.

Explanation:

a->n->m->{                      // Method with integer-array and two integer parameters and integer-array return-type
  int l=a.length-m-n,           //  Length of the array minus the two integers
      r[]=new int[l];           //  Result integer-array
  System.arraycopy(a,n,r,0,l);  //  Java built-in to copy part of an array to another array
  return r;                     //  Return result-String
}                               // End of method

System.arraycopy:

arraycopy(Object src, int srcPos, Object dest, int destPos, int length):

The java.lang.System.arraycopy() method copies an array from the specified source array, beginning at the specified position, to the specified position of the destination array. A subsequence of array components are copied from the source array referenced by src to the destination array referenced by dest. The number of components copied is equal to the length argument.

The components at positions srcPos through srcPos + length - 1 in the source array are copied into positions destPos through destPos + length - 1, respectively, of the destination array.

#Java 8, 82 bytes

a->n->m->{int l=a.length-m-n,r[]=new int[l];System.arraycopy(a,n,r,0,l);return r;}

Try it here.

Alternative with same (82) byte-count using a loop:

(a,n,m)->{int l=a.length-m,r[]=new int[l-n],i=0;for(;n<l;r[i++]=a[n++]);return r;}

Try it here.

Explanation:

a->n->m->{                      // Method with integer-array and two integer parameters and integer-array return-type
  int l=a.length-m-n,           //  Length of the array minus the two integers
      r[]=new int[l];           //  Result integer-array
  System.arraycopy(a,n,r,0,l);  //  Java built-in to copy part of an array to another array
  return r;                     //  Return result-String
}                               // End of method

System.arraycopy:

arraycopy(Object src, int srcPos, Object dest, int destPos, int length):

The java.lang.System.arraycopy() method copies an array from the specified source array, beginning at the specified position, to the specified position of the destination array. A subsequence of array components are copied from the source array referenced by src to the destination array referenced by dest. The number of components copied is equal to the length argument.

The components at positions srcPos through srcPos + length - 1 in the source array are copied into positions destPos through destPos + length - 1, respectively, of the destination array.

Java 8, 82 bytes

a->n->m->{int l=a.length-m-n,r[]=new int[l];System.arraycopy(a,n,r,0,l);return r;}

Try it here.

Alternative with same (82) byte-count using a loop:

(a,n,m)->{int l=a.length-m,r[]=new int[l-n],i=0;for(;n<l;r[i++]=a[n++]);return r;}

Try it here.

Explanation:

a->n->m->{                      // Method with integer-array and two integer parameters and integer-array return-type
  int l=a.length-m-n,           //  Length of the array minus the two integers
      r[]=new int[l];           //  Result integer-array
  System.arraycopy(a,n,r,0,l);  //  Java built-in to copy part of an array to another array
  return r;                     //  Return result-String
}                               // End of method

System.arraycopy:

arraycopy(Object src, int srcPos, Object dest, int destPos, int length):

The java.lang.System.arraycopy() method copies an array from the specified source array, beginning at the specified position, to the specified position of the destination array. A subsequence of array components are copied from the source array referenced by src to the destination array referenced by dest. The number of components copied is equal to the length argument.

The components at positions srcPos through srcPos + length - 1 in the source array are copied into positions destPos through destPos + length - 1, respectively, of the destination array.

Added TIO-link for second solution
Source Link
Kevin Cruijssen
  • 136.3k
  • 14
  • 155
  • 394

#Java 8, 82 bytes

a->n->m->{int l=a.length-m-n,r[]=new int[l];System.arraycopy(a,n,r,0,l);return r;}

Try it here.

Alternative with same (82) byte-count using a loop:

(a->m->n,n,m)->{int l=a.length-m,r[]=new int[l-n],i=0;for(;n<l;r[i++]=a[n++]);return r;}

Try it here.

Explanation:

Try it here.

a->n->m->{                      // Method with integer-array and two integer parameters and integer-array return-type
  int l=a.length-m-n,           //  Length of the array minus the two integers
      r[]=new int[l];           //  Result integer-array
  System.arraycopy(a,n,r,0,l);  //  Java built-in to copy part of an array to another array
  return r;                     //  Return result-String
}                               // End of method

System.arraycopy:

arraycopy(Object src, int srcPos, Object dest, int destPos, int length):

The java.lang.System.arraycopy() method copies an array from the specified source array, beginning at the specified position, to the specified position of the destination array. A subsequence of array components are copied from the source array referenced by src to the destination array referenced by dest. The number of components copied is equal to the length argument.

The components at positions srcPos through srcPos + length - 1 in the source array are copied into positions destPos through destPos + length - 1, respectively, of the destination array.

#Java 8, 82 bytes

a->n->m->{int l=a.length-m-n,r[]=new int[l];System.arraycopy(a,n,r,0,l);return r;}

Alternative with same (82) byte-count using a loop:

a->m->n->{int l=a.length-m,r[]=new int[l-n],i=0;for(;n<l;r[i++]=a[n++]);return r;}

Explanation:

Try it here.

a->n->m->{                      // Method with integer-array and two integer parameters and integer-array return-type
  int l=a.length-m-n,           //  Length of the array minus the two integers
      r[]=new int[l];           //  Result integer-array
  System.arraycopy(a,n,r,0,l);  //  Java built-in to copy part of an array to another array
  return r;                     //  Return result-String
}                               // End of method

System.arraycopy:

arraycopy(Object src, int srcPos, Object dest, int destPos, int length):

The java.lang.System.arraycopy() method copies an array from the specified source array, beginning at the specified position, to the specified position of the destination array. A subsequence of array components are copied from the source array referenced by src to the destination array referenced by dest. The number of components copied is equal to the length argument.

The components at positions srcPos through srcPos + length - 1 in the source array are copied into positions destPos through destPos + length - 1, respectively, of the destination array.

#Java 8, 82 bytes

a->n->m->{int l=a.length-m-n,r[]=new int[l];System.arraycopy(a,n,r,0,l);return r;}

Try it here.

Alternative with same (82) byte-count using a loop:

(a,n,m)->{int l=a.length-m,r[]=new int[l-n],i=0;for(;n<l;r[i++]=a[n++]);return r;}

Try it here.

Explanation:

a->n->m->{                      // Method with integer-array and two integer parameters and integer-array return-type
  int l=a.length-m-n,           //  Length of the array minus the two integers
      r[]=new int[l];           //  Result integer-array
  System.arraycopy(a,n,r,0,l);  //  Java built-in to copy part of an array to another array
  return r;                     //  Return result-String
}                               // End of method

System.arraycopy:

arraycopy(Object src, int srcPos, Object dest, int destPos, int length):

The java.lang.System.arraycopy() method copies an array from the specified source array, beginning at the specified position, to the specified position of the destination array. A subsequence of array components are copied from the source array referenced by src to the destination array referenced by dest. The number of components copied is equal to the length argument.

The components at positions srcPos through srcPos + length - 1 in the source array are copied into positions destPos through destPos + length - 1, respectively, of the destination array.

added 136 characters in body
Source Link
Kevin Cruijssen
  • 136.3k
  • 14
  • 155
  • 394

#Java 8, 82 bytes

a->n->m->{int l=a.length-m-n,r[]=new int[l];System.arraycopy(a,n,r,0,l);return r;}

Alternative with same (82) byte-count using a loop:

a->m->n->{int l=a.length-m,r[]=new int[l-n],i=0;for(;n<l;r[i++]=a[n++]);return r;}

Explanation:

Try it here.

a->n->m->{                      // Method with integer-array and two integer parameters and integer-array return-type
  int l=a.length-m-n,           //  Length of the array minus the two integers
      r[]=new int[l];           //  Result integer-array
  System.arraycopy(a,n,r,0,l);  //  Java built-in to copy part of an array to another array
  return r;                     //  Return result-String
}                               // End of method

System.arraycopy:

arraycopy(Object src, int srcPos, Object dest, int destPos, int length):

The java.lang.System.arraycopy() method copies an array from the specified source array, beginning at the specified position, to the specified position of the destination array. A subsequence of array components are copied from the source array referenced by src to the destination array referenced by dest. The number of components copied is equal to the length argument.

The components at positions srcPos through srcPos + length - 1 in the source array are copied into positions destPos through destPos + length - 1, respectively, of the destination array.

#Java 8, 82 bytes

a->n->m->{int l=a.length-m-n,r[]=new int[l];System.arraycopy(a,n,r,0,l);return r;}

Explanation:

Try it here.

a->n->m->{                      // Method with integer-array and two integer parameters and integer-array return-type
  int l=a.length-m-n,           //  Length of the array minus the two integers
      r[]=new int[l];           //  Result integer-array
  System.arraycopy(a,n,r,0,l);  //  Java built-in to copy part of an array to another array
  return r;                     //  Return result-String
}                               // End of method

System.arraycopy:

arraycopy(Object src, int srcPos, Object dest, int destPos, int length):

The java.lang.System.arraycopy() method copies an array from the specified source array, beginning at the specified position, to the specified position of the destination array. A subsequence of array components are copied from the source array referenced by src to the destination array referenced by dest. The number of components copied is equal to the length argument.

The components at positions srcPos through srcPos + length - 1 in the source array are copied into positions destPos through destPos + length - 1, respectively, of the destination array.

#Java 8, 82 bytes

a->n->m->{int l=a.length-m-n,r[]=new int[l];System.arraycopy(a,n,r,0,l);return r;}

Alternative with same (82) byte-count using a loop:

a->m->n->{int l=a.length-m,r[]=new int[l-n],i=0;for(;n<l;r[i++]=a[n++]);return r;}

Explanation:

Try it here.

a->n->m->{                      // Method with integer-array and two integer parameters and integer-array return-type
  int l=a.length-m-n,           //  Length of the array minus the two integers
      r[]=new int[l];           //  Result integer-array
  System.arraycopy(a,n,r,0,l);  //  Java built-in to copy part of an array to another array
  return r;                     //  Return result-String
}                               // End of method

System.arraycopy:

arraycopy(Object src, int srcPos, Object dest, int destPos, int length):

The java.lang.System.arraycopy() method copies an array from the specified source array, beginning at the specified position, to the specified position of the destination array. A subsequence of array components are copied from the source array referenced by src to the destination array referenced by dest. The number of components copied is equal to the length argument.

The components at positions srcPos through srcPos + length - 1 in the source array are copied into positions destPos through destPos + length - 1, respectively, of the destination array.

Source Link
Kevin Cruijssen
  • 136.3k
  • 14
  • 155
  • 394
Loading