Skip to main content
added 107 characters in body
Source Link
Charlie
  • 12.9k
  • 1
  • 42
  • 100

C# (.NET Core), 10085 bytes

c=>s=>{var r=new int[c,c];for(int i=0,j;i++<c;;s>0;)for(j=0;j<c;)r[iint j=s-1-;j-->0;)r[s,j++]=i>s||j>s?0:i>j?i:j;returnj]=r[j,s]=s+1;return r;}

Try it online!Try it online!

A port of Kevin Cruijssen's answer, which was much better than mine.

C# (.NET Core), 100 bytes

c=>s=>{var r=new int[c,c];for(int i=0,j;i++<c;)for(j=0;j<c;)r[i-1,j++]=i>s||j>s?0:i>j?i:j;return r;}

Try it online!

C# (.NET Core), 85 bytes

c=>s=>{var r=new int[c,c];for(;s>0;)for(int j=s--;j-->0;)r[s,j]=r[j,s]=s+1;return r;}

Try it online!

A port of Kevin Cruijssen's answer, which was much better than mine.

Source Link
Charlie
  • 12.9k
  • 1
  • 42
  • 100

C# (.NET Core), 100 bytes

c=>s=>{var r=new int[c,c];for(int i=0,j;i++<c;)for(j=0;j<c;)r[i-1,j++]=i>s||j>s?0:i>j?i:j;return r;}

Try it online!