Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

3 yet another fantastic suggestion by my man kev

# Java (OpenJDK 8), 7067 bytes

a->{int i=1;int[]c=newc[]=new int[a.length+i];forlength+1],i=1;for(int u:a)c[i++]=u;return c;}


This was a fun little challenge in Java since Java arrays are static in size, but it seems like this is significantly less challenging in every language that can just slap a zero on for the first- excuse me, zeroth element

Explanation:

int i=1;i=1,c[]=new int[a.length+i];    ////Initialize counter
int[]c=new int[a.length+i];   and //declare new array with length: 1 + input array length
for(int u:a)    //Loop through each element in input array
c[i++]=u;    //Increment counter after shifting each element up one spot in the output array
return c;    //return new array starting at index 1


Credit:

-3 bytes thanks to Kevin Cruijssen!

# Java (OpenJDK 8), 70 bytes

a->{int i=1;int[]c=new int[a.length+i];for(int u:a)c[i++]=u;return c;}


Try it online!

This was a fun little challenge in Java since Java arrays are static in size, but it seems like this is significantly less challenging in every language that can just slap a zero on for the first- excuse me, zeroth element

Explanation:

int i=1;    //Initialize counter
int[]c=new int[a.length+i];    //declare new array with length: 1 + input array length
for(int u:a)    //Loop through each element in input array
c[i++]=u;    //Increment counter after shifting each element up one spot in the output array
return c;    //return new array starting at index 1


# Java (OpenJDK 8), 67 bytes

a->{int c[]=new int[a.length+1],i=1;for(int u:a)c[i++]=u;return c;}


Try it online!

This was a fun little challenge in Java since Java arrays are static in size, but it seems like this is significantly less challenging in every language that can just slap a zero on for the first- excuse me, zeroth element

Explanation:

int i=1,c[]=new int[a.length+i];    ////Initialize counter and declare new array with length: 1 + input array length
for(int u:a)    //Loop through each element in input array
c[i++]=u;    //Increment counter after shifting each element up one spot in the output array
return c;    //return new array starting at index 1


Credit:

-3 bytes thanks to Kevin Cruijssen!

2 added 207 characters in body

# Java (OpenJDK 8), 70 bytes

a->{int i=1;int[]c=new int[a.length+i];for(int u:a)c[i++]=u;return c;}


Try it online!

This was a fun little challenge in Java since Java arrays are static in size, but it seems like this is significantly less challenging in every language that can just slap a zero on for the first- excuse me, zeroth element

Explanation:

int i=1;    //Initialize counter
int[]c=new int[a.length+i];    //declare new array with length: 1 + input array length
for(int u:a)    //Loop through each element in input array
c[i++]=u;    //Increment counter after shifting each element up one spot in the output array
return c;    //return new array starting at index 1


# Java (OpenJDK 8), 70 bytes

a->{int i=1;int[]c=new int[a.length+i];for(int u:a)c[i++]=u;return c;}


Try it online!

Explanation:

int i=1;    //Initialize counter
int[]c=new int[a.length+i];    //declare new array with length: 1 + input array length
for(int u:a)    //Loop through each element in input array
c[i++]=u;    //Increment counter after shifting each element up one spot in the output array
return c;    //return new array starting at index 1


# Java (OpenJDK 8), 70 bytes

a->{int i=1;int[]c=new int[a.length+i];for(int u:a)c[i++]=u;return c;}


Try it online!

This was a fun little challenge in Java since Java arrays are static in size, but it seems like this is significantly less challenging in every language that can just slap a zero on for the first- excuse me, zeroth element

Explanation:

int i=1;    //Initialize counter
int[]c=new int[a.length+i];    //declare new array with length: 1 + input array length
for(int u:a)    //Loop through each element in input array
c[i++]=u;    //Increment counter after shifting each element up one spot in the output array
return c;    //return new array starting at index 1

1

# Java (OpenJDK 8), 70 bytes

a->{int i=1;int[]c=new int[a.length+i];for(int u:a)c[i++]=u;return c;}


Try it online!

Explanation:

int i=1;    //Initialize counter
int[]c=new int[a.length+i];    //declare new array with length: 1 + input array length
for(int u:a)    //Loop through each element in input array
c[i++]=u;    //Increment counter after shifting each element up one spot in the output array
return c;    //return new array starting at index 1