Problem
Given an integer number, a starting value start, and an ending value end, write a function solution that checks if number is within the range from start to end inclusive.
Constraints
number,start, andendare integers between -100 and 100 inclusive.startis less than or equal toend.- If
numberis within the range, return the string "YES"; if it is outside the range, return the string "NO".
Test Case
| Test Case Number | number | start | end | return |
|---|---|---|---|---|
| 1 | 5 | 1 | 10 | "YES" |
| 2 | -1 | -10 | -1 | "YES" |
| 3 | 7 | 8 | 20 | "NO" |
Explanation for Test Case 1
- When
number = 5,start = 1, andend = 10, 5 is within the range from 1 to 10, so return "YES".
Explanation for Test Case 2
- When
number = -1,start = -10, andend = -1, -1 is within the range from -10 to -1, so return "YES".
Explanation for Test Case 3
- When
number = 7,start = 8, andend = 20, 7 is not within the range from 8 to 20, so return "NO".