You are given a rectangular matrix (a list of lists of numbers) and two integers low and high with low <= high.
Return a new grid of the same shape (a list of lists of numbers) where each cell is the corresponding value v clamped into the range [low, high]:
v < low, use low;v > high, use high;v unchanged.The original matrix must not be modified.
NOTE: This is a function-type question — you only write the function. Do not read input or print anything; a hidden checker calls your function and checks its return value.
Arguments
[[1, 5, 10]]
2
8
Returns
[[2, 5, 8]]