スポンサーリンク

【LeetCode】1523. Count Odd Numbers in an Interval Range 解答・解説【Python】

スポンサーリンク
スポンサーリンク
この記事は約2分で読めます。

問題

原文

Given two non-negative integers low and high. Return the count of odd numbers between low and high (inclusive).

 

Example 1:

Example 2:

 

Constraints:

  • 0 <= low <= high <= 10^9

 

内容

2つの非負整数low,highが与えられるので、lowとhighの間にある奇数の数を返してください。

 

※正しくない可能性があります。

 

解答

解答1:Python

 

 

 

解答2:

 

 

 

メモ・参考・感想

■メモ

odd number:奇数

 

 

前:202. Happy Number

次:1491. Average Salary Excluding the Minimum and Maximum Salary

LeetCode 解答・解説記事一覧

コメント