id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

jebbert@volusia.k12.fl.us > quiz2022_02_24_SLHL_pascalsTriangle
prev  |  next  |  chance

Write a method that returns the 'row' row number of Pascal's Triangle as an array of 'long'. You may NOT hard-code Pascal's Triangle. You can choose how you do this, but the row must be CALCULATED in some way. You can use recursion, a formula, or something else, but it must be CALCULATED. I'm looking at YOU Kyle! No hard coding! As a precondition, you may assume that 0<=row<=19. You ARE allowed to look online for formulas or other general information about Pascal's Triangle, but you are NOT allowed to look for algorithms or code. Note that the "first" row of Pascal's Triangle is called row zero. So when 'row' is 0, you should return {1}.


quiz2022_02_24_SLHL_pascalsTriangle(13) → [1, 13, 78, 286, 715, 1287, 1716, 1716, 1287, 715, 286, 78, 13, 1]
quiz2022_02_24_SLHL_pascalsTriangle(17) → [1, 17, 136, 680, 2380, 6188, 12376, 19448, 24310, 24310, 19448, 12376, 6188, 2380, 680, 136, 17, 1]
quiz2022_02_24_SLHL_pascalsTriangle(0) → [1]

...Save, Compile, Run (ctrl-enter)

public long[] quiz2022_02_24_SLHL_pascalsTriangle(int row) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 290

Copyright Nick Parlante 2017 - privacy