Back to problems

Piecewise Linear Interpolation with Extrapolation

Algorithm · Citadel · Medium

Piecewise Linear Interpolation from Unordered Knots Medium · Topics · Company Tags · Hints You are given a collection of n two‑dimensional points (x_knots[i], y_knots[i]) with all x‑coordinates distinct. First, rearrange the points so that their x‑coordinates are in strictly increasing order. Then join every consecutive pair of sorted points with a straight line. This creates a continuous, piecewise‑linear function f(x). Write a routine that, for any input x_query, returns…

Checking your access…