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

 

pascalTriangle


Write a method that returns a String representing the row of Pascal's Triangle represented by the non-negative integer input parameter rowNum. The first row of Pascal's Triangle is row number zero. Notice that the row number corresponds to the first number in the row that is not a 1, so row 3 is "1 3 3 1". You must return a String representation of the row with one space between each number. Notice that there are no leading or trailing spaces. The input parameter rowNum will not exceed 30.


pascalTriangle(0) → "1"
pascalTriangle(1) → "1 1"
pascalTriangle(2) → "1 2 1"

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

public String pascalTriangle(int rowNum) { }

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: 310

Copyright Nick Parlante 2017 - privacy