Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save CodeGolfScotland/2bb50e11d58dc149e1a303ab87ae45f2 to your computer and use it in GitHub Desktop.
Save CodeGolfScotland/2bb50e11d58dc149e1a303ab87ae45f2 to your computer and use it in GitHub Desktop.
Code Golf December 2016

December 2016 - Oh xmas tree, oh xmas tree

Task

Return an xmas tree n rows in length.

n will always be greater than 0.

Examples:

(1) => * 

(3) =>
  *
 ***
*****

(5) =>  
    *
   ***
  *****
 *******
*********

*^You can assume that you will always recieved valid input

About Code Golf Scotland

@HDudzus
Copy link

HDudzus commented Dec 31, 2016

Language: Haskell
Length: 65
A little late for Christmas, but still in December. :-)

t n=unlines$map(\h->replicate(n-h)' '++replicate(2*h-1)'*')[1..n]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment