Clamp Range

L1 Easy Arrays & Hashing
Concept
Clamping pushes a value into an allowed band: anything below low becomes low, anything above high becomes high.
Return a new array where every value in nums is clamped into the inclusive range low...high. Values already inside the range stay unchanged. You may assume low is at most high.
Examples
▸ nums = [1, 5, 10], low = 2, high = 7
→ [2, 5, 7]
▸ nums = [-5, 50], low = 0, high = 10
→ [0, 10]
▸ nums = [], low = 1, high = 3
→ []
Progressive Hints
Hint 1 · Nudge
Anything too small becomes low, anything too big becomes high, everything else stays.
Hint 2 · Plan
Build a new array. For each value, stamp it into the band: values below low become low, values above high become high, the rest keep their value. Return the array.
Hint 3 · Approach
result = []. For each n: if n < low then n = low; else if n > high then n = high. Append n. Return result.
Output
// Run your code to see the output here.