← Back to companies
[ OK ] Loaded —
[ INFO ]
$ cd
$ ls -lt
01
02
03
04
05
$ ls -lt
01
02
03
04
05
user@intervues:~/$
Practice/Google/Leetcode 1523. Count Odd Numbers in an Interval Range
CodingMust
Given two non-negative integers low and high, return the count of even integers in the inclusive range [low, high].
You must implement an efficient solution that works in constant time without iterating through the range, as the input values can be as large as 10^9.
low to high (inclusive)low and high are non-negative integersExample 1:
Input: low = 3, high = 7 Output: 2 Explanation: The even numbers in the range are 4 and 6.
Example 2:
Input: low = 8, high = 10 Output: 2 Explanation: The even numbers in the range are 8 and 10.
Example 3:
Input: low = 4, high = 4 Output: 1 Explanation: The range contains only 4, which is even.
Example 4:
Input: low = 5, high = 5 Output: 0 Explanation: The range contains only 5, which is odd.