当前位置:网站首页>Leetcode 1523. count odd numbers within the interval
Leetcode 1523. count odd numbers within the interval
2022-07-26 13:11:00 【PUdd】
LeetCode 1523. Count the odd number in the interval
Their thinking
| low | high | Number |
|---|---|---|
| accidentally | accidentally | (high-low+0)/2 |
| p. | p. | (high-low+2)/2 |
| accidentally | p. | (high-low+1)/2 |
| p. | accidentally | (high-low+1)/2 |
C++ Code
class Solution
{
public:
int countOdds(int low, int high)
{
return (high-low+low%2+high%2)/2;
}
};
边栏推荐
- B+树挑选索引(1)---mysql从入门到精通(二十二)
- Today's sleep quality record 75 points
- From January to June, China's ADAS suppliers accounted for 9%, and another parts giant comprehensively laid out the new smart drive track
- A college archives management system based on asp.net
- Kubernetes---- installing and deploying NFS servers
- Extra(5)—mysql执行计划(五十一)
- Bitwise and how to write SQL
- 同花顺开的账户安全吗?
- [typescript] typescript common types (Part 1)
- B+树挑选索引(2)---mysql从入门到精通(二十三)
猜你喜欢

Food safety | is self-made food purchased online healthy food? Don't fall into these misunderstandings

12 brand management of commodity system in gulimall background management

(int argc, char** argv) command line parameters in visual stdio (VS)

Version of NDK matched the requested version 21.0.6113669. versions available locally: 2
![[applet] why can't the onreachbottom event be triggered? (one second)](/img/da/3641040c63f6db4d227dcf2ff89919.png)
[applet] why can't the onreachbottom event be triggered? (one second)

jvm:类加载子系统干什么的?由什么组成?需要记住哪些八股文?
![[upper computer tutorial] Application of integrated stepping motor and Delta PLC (as228t) under CANopen communication](/img/d4/c677de31f73a0e0a4b8b10b91e984a.png)
[upper computer tutorial] Application of integrated stepping motor and Delta PLC (as228t) under CANopen communication

基于BERT的情感分析模型

Food safety | what food can be heated in a microwave oven? You should know these potential safety hazards

How to face scientific and technological unemployment?
随机推荐
Emotion analysis model based on Bert
Kubernetes----PV和PVC的生命周期简介
Student examination system based on C #
1312_ Apply 7z command for compression and decompression
1312_适用7z命令进行压缩与解压
Can MySQL customize variable parameter storage functions?
key&key_len&ref&filtered(4)—mysql执行计划(五十)
Who is responsible for the problems of virtual idol endorsement products? And listen to the lawyer's analysis
同花顺开的账户安全吗?
Flutter textfield sets the height and automatically wraps lines, and the rounded border removes the underline
Kubernetes APIServer 限流策略
Food safety | these common foods are poisonous! Check your dining table quickly
Kubernetes Flannel:HOST-GW模式
Version of NDK matched the requested version 21.0.6113669. versions available locally: 2
Code examples explain the difference between [reentrant lock] and [non reentrant lock]?
为什么要做“密评”?
SLAM 02.整体框架
pomerium
[typescript] typescript common types (Part 2)
C#把Type当做泛型T,来作为方法的泛型进行使用