Basic valid integer
Input
parse_int_in_range(' 42 ', 0, 100)
Output
42
Whitespace is trimmed; 42 is within [0, 100].
Full lesson preview
Safely parse a string to an integer and ensure it lies within a specified inclusive range.
Problem statement
Task
Examples
Input
parse_int_in_range(' 42 ', 0, 100)
Output
42
Whitespace is trimmed; 42 is within [0, 100].
Input format
Output format
Constraints
Samples
Input
parse_int_in_range('-5', -10, 0)
Output
-5
Negative values are supported and must be within the provided bounds.