Skip to main content
Commonmark migration
Source Link

#C# 6, 125+31 125+18 = 143 bytes

C# 6, 125+31 125+18 = 143 bytes

string f(int[] n,string s="")=>s+string.Join(" ",n)+"\n"+(n.Length>1?f(n.Zip(n.Skip(1),(a,b)=>(a+b)%10).ToArray(),s+" "):"");

The +18 is for using System.Linq;

Thanks to @TheLethalCoder for saving 13 bytes, by pointing out a unnecessary using statement

#C# 6, 125+31 125+18 = 143 bytes

string f(int[] n,string s="")=>s+string.Join(" ",n)+"\n"+(n.Length>1?f(n.Zip(n.Skip(1),(a,b)=>(a+b)%10).ToArray(),s+" "):"");

The +18 is for using System.Linq;

Thanks to @TheLethalCoder for saving 13 bytes, by pointing out a unnecessary using statement

C# 6, 125+31 125+18 = 143 bytes

string f(int[] n,string s="")=>s+string.Join(" ",n)+"\n"+(n.Length>1?f(n.Zip(n.Skip(1),(a,b)=>(a+b)%10).ToArray(),s+" "):"");

The +18 is for using System.Linq;

Thanks to @TheLethalCoder for saving 13 bytes, by pointing out a unnecessary using statement

added 78 characters in body
Source Link
Sok
  • 6.2k
  • 1
  • 17
  • 30

#C# 6, 125+31125+31 125+18 = 156143 bytes

string f(int[] n,string s="")=>s+String=>s+string.Join(" ",n)+"\n"+(n.Length>1?f(n.Zip(n.Skip(1),(a,b)=>(a+b)%10).ToArray(),s+" "):"");

The +31+18 is for the two required usings: using System;using System.Linq;.

Thanks to @TheLethalCoder for saving 13 bytes, by pointing out a unnecessary using statement

#C# 6, 125+31 = 156 bytes

string f(int[] n,string s="")=>s+String.Join(" ",n)+"\n"+(n.Length>1?f(n.Zip(n.Skip(1),(a,b)=>(a+b)%10).ToArray(),s+" "):"");

The +31 is for the two required usings: using System;using System.Linq;.

#C# 6, 125+31 125+18 = 143 bytes

string f(int[] n,string s="")=>s+string.Join(" ",n)+"\n"+(n.Length>1?f(n.Zip(n.Skip(1),(a,b)=>(a+b)%10).ToArray(),s+" "):"");

The +18 is for using System.Linq;

Thanks to @TheLethalCoder for saving 13 bytes, by pointing out a unnecessary using statement

Source Link
Sok
  • 6.2k
  • 1
  • 17
  • 30

#C# 6, 125+31 = 156 bytes

string f(int[] n,string s="")=>s+String.Join(" ",n)+"\n"+(n.Length>1?f(n.Zip(n.Skip(1),(a,b)=>(a+b)%10).ToArray(),s+" "):"");

The +31 is for the two required usings: using System;using System.Linq;.