Draft

Area under the graph

Description:

alternative text

The graph consists of points connected by straight lines. Input is series of points. Calculate surface area under the graph (painted grey). Points will be already sorted by x. Input will never be an empty array. x and y are always natural numbers.

For example: Input:

[
//[x, y]
  [1, 2], // A
  [2, 3], // B
  [4, 2], // C
  [5, 1], // D
]

Output: 9

Similar Kata:

More By Author:

Check out these other kata created by kzm

Stats:

CreatedMar 16, 2019
Warriors Trained14
Total Skips0
Total Code Submissions16
Total Times Completed8
JavaScript Completions8
Total Stars0
% of votes with a positive feedback rating64% of 7
Total "Very Satisfied" Votes4
Total "Somewhat Satisfied" Votes1
Total "Not Satisfied" Votes2
Total Rank Assessments7
Average Assessed Rank
7 kyu
Highest Assessed Rank
7 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • kzm Avatar
Ad