6 kyu

Cumulative Triangle

156 of 1,426stephenyu

Description:

Imagine a triangle of numbers which follows this pattern:

  • Starting with the number "1", "1" is positioned at the top of the triangle. As this is the 1st row, it can only support a single number.
  • The 2nd row can support the next 2 numbers: "2" and "3"
  • Likewise, the 3rd row, can only support the next 3 numbers: "4", "5", "6"
  • And so on; this pattern continues.
    1
   2 3
  4 5 6
 7 8 9 10
...

Given N, return the sum of all numbers on the Nth Row:

1 <= N <= 10,000

Algorithms
Geometry

More By Author:

Check out these other kata created by stephenyu

Stats:

CreatedFeb 16, 2014
PublishedFeb 17, 2014
Warriors Trained2337
Total Skips60
Total Code Submissions3520
Total Times Completed1426
Ruby Completions156
Python Completions732
JavaScript Completions408
Julia Completions32
Haskell Completions46
Groovy Completions25
C Completions150
COBOL Completions10
Total Stars45
% of votes with a positive feedback rating93% of 261
Total "Very Satisfied" Votes229
Total "Somewhat Satisfied" Votes27
Total "Not Satisfied" Votes5
Ad
Contributors
  • stephenyu Avatar
  • jhoffner Avatar
  • raulbc777 Avatar
  • suic Avatar
  • davidhu2000 Avatar
  • rowcased Avatar
  • cliffstamp Avatar
  • stellartux Avatar
  • akar-0 Avatar
  • saudiGuy Avatar
Ad