Pascal's Triangle Medium

+100 PTS

Before you start the test, check out our tutorial challenge

  • TYPE CODE PRACTICE CHALLENGE
  • LANGUAGES BASH, C, C++, C# AND 21 MORE
    LANGUAGES BASH, C, C++, C#, CLOJURE, ELIXIR, ERLANG, GO, GROOVY, HASKELL, JAVA, JAVASCRIPT, JULIA, KOTLIN, NIM, PERL, PHP, PYTHON2, PYTHON, RUBY, RUST, SCALA, SWIFT, TYPESCRIPT, VB
  • TIME ~25MIN

Pascal's Triangle

Challenge outline

Hello and welcome to the next live coding challenge!


Write a function, which returns the flatten version of the Pascal's Triangle of the depth n. What is the Pascal's Triangle, you can read here.



Examples

  • n=3 -> 1 1 1 1 2 1
  • n=4 -> 1 1 1 1 211 3 3 1


Input

  • n - triangle's depth


Output

  • string including the flatten version of the Pascal's Triangle of the depth n with values separated with spaces


Constraints

  • 0 <= n <= 30



You can solve this programming contest in Java, JavaScript, Python, C++ and many more languages. If you want, you can also take part in other March 2019 competitions. Below you can find some of them:



Have fun and good luck! :)


Did you like this challenge and would like to try your hand at some interesting big programming competitions? Check what’s all over the news in tech world in April 2019 in our article with upcoming IT Conferences, Hackathons and Online Challenges.