Skip to main content
added 76 characters in body
Source Link
bigyihsuan
  • 10.8k
  • 1
  • 23
  • 66

Go, 130130 123 bytes

func f(r,c int)(s string){R:="<tr>"
for d,i:="<th>"="<th>A",0;i<r;i++{if i>0{d="<td>"d="<td>A"}
s+=Rs+="<tr>"
for j:=0;j<c;j++{s+=d+"A"s+=d}}
return"<table>"+s}

Attempt This Online!Attempt This Online!

  • -7 bytes from removing unused variable, condensing string literals (@xigoi)

Go, 130 bytes

func f(r,c int)(s string){R:="<tr>"
for d,i:="<th>",0;i<r;i++{if i>0{d="<td>"}
s+=R
for j:=0;j<c;j++{s+=d+"A"}}
return"<table>"+s}

Attempt This Online!

Go, 130 123 bytes

func f(r,c int)(s string){for d,i:="<th>A",0;i<r;i++{if i>0{d="<td>A"}
s+="<tr>"
for j:=0;j<c;j++{s+=d}}
return"<table>"+s}

Attempt This Online!

  • -7 bytes from removing unused variable, condensing string literals (@xigoi)
Source Link
bigyihsuan
  • 10.8k
  • 1
  • 23
  • 66

Go, 130 bytes

func f(r,c int)(s string){R:="<tr>"
for d,i:="<th>",0;i<r;i++{if i>0{d="<td>"}
s+=R
for j:=0;j<c;j++{s+=d+"A"}}
return"<table>"+s}

Attempt This Online!