about | help | code help+videos | done | prefs |
interpolate
If the two known points are given by the coordinates (x0,y0) and (x1,y1), the linear interpolant is the straight line between these points. For a given x, you can find the interpolated value y, by using y = y0 + (x-x0)*((y1-y0)/(x1-x0)). Given (x0,y0), (x1,y1), and x, return y (rounded to two decimal places). interpolate(1, 1, 3, 3, 2) → 2.0 interpolate(1, 1, 2, 2, 1.5) → 1.5 interpolate(2, 3, 6, 11, 4) → 7.0 ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 100
Copyright Nick Parlante 2017 - privacy