Clamp value in range
Java
Medium
6 views
Problem Description
Task: clamp x into [low, high] and return clamped value.
Output Format
Return value
Official Solution
static int clamp(int x,int low,int high){if(x<low) return low; if(x>high) return high; return x;}
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!