Skip to main content
Tweeted twitter.com/StackCodeGolf/status/671010303799373824
added 12 characters in body
Source Link
Calvin's Hobbies
  • 90k
  • 46
  • 339
  • 555

Write a program or function that takes in a positive integer N.

When N is 1, output

/\
\/

When N is 2, output

/\/\
\/ /
/ /
\/

When N is 3, output

/\/\/\
\/ / /
/ / /
\/ /
/ /
\/

When N is 4, output

/\/\/\/\
\/ / / /
/ / / /
\/ / /
/ / /
\/ /
/ /
\/

For larger N the pattern continues, a new layer is added every time N is incremented.

  • "Output" means print the slash pattern or return it as a string.
  • A single trailing newline in the output is allowed.
  • Trailing spaces in the output are allowed but leading spaces are not.

The shortest code in bytes wins.

Write a program that takes in a positive integer N.

When N is 1, output

/\
\/

When N is 2, output

/\/\
\/ /
/ /
\/

When N is 3, output

/\/\/\
\/ / /
/ / /
\/ /
/ /
\/

When N is 4, output

/\/\/\/\
\/ / / /
/ / / /
\/ / /
/ / /
\/ /
/ /
\/

For larger N the pattern continues, a new layer is added every time N is incremented.

  • "Output" means print the slash pattern or return it as a string.
  • A single trailing newline in the output is allowed.
  • Trailing spaces in the output are allowed but leading spaces are not.

The shortest code in bytes wins.

Write a program or function that takes in a positive integer N.

When N is 1, output

/\
\/

When N is 2, output

/\/\
\/ /
/ /
\/

When N is 3, output

/\/\/\
\/ / /
/ / /
\/ /
/ /
\/

When N is 4, output

/\/\/\/\
\/ / / /
/ / / /
\/ / /
/ / /
\/ /
/ /
\/

For larger N the pattern continues, a new layer is added every time N is incremented.

  • "Output" means print the slash pattern or return it as a string.
  • A single trailing newline in the output is allowed.
  • Trailing spaces in the output are allowed but leading spaces are not.

The shortest code in bytes wins.

Source Link
Calvin's Hobbies
  • 90k
  • 46
  • 339
  • 555

N Slab Slanted Slash Cake

Write a program that takes in a positive integer N.

When N is 1, output

/\
\/

When N is 2, output

/\/\
\/ /
/ /
\/

When N is 3, output

/\/\/\
\/ / /
/ / /
\/ /
/ /
\/

When N is 4, output

/\/\/\/\
\/ / / /
/ / / /
\/ / /
/ / /
\/ /
/ /
\/

For larger N the pattern continues, a new layer is added every time N is incremented.

  • "Output" means print the slash pattern or return it as a string.
  • A single trailing newline in the output is allowed.
  • Trailing spaces in the output are allowed but leading spaces are not.

The shortest code in bytes wins.