Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 |
Tags
- 공유라이브러리
- Motion Planning
- path planning
- Graph Neural Network
- 경로생성
- solver
- OSQP
- Dubins Path
- GNN
- 수치최적화
- C++
- Leetcode
- Recursion
- GIT
- Frenet Coordinate
- DynamicProgramming
- C
- 정적라이브러리
- CUDA
- PathPlanning
- MDP
- 동적라이브러리
- Hybrid A star
- 백준
- 선형대수
- self driving car
- 강화학습
- autonomous vehicle
- 소프티어
- CPP
Archives
- Today
- Total
Swimmer
[LeetCode] 1342 Number of Steps to Reduce a Number to Zero, C 본문
Solution
- Simple sequential calculation
Other Solution
- can use binary operation
int numberOfSteps(int num) {
int step = 0;
while (num != 0)
{
if (num % 2 == 0)
{
num = num / 2;
}
else
{
num -= 1;
}
++step;
}
return step;
}
'코딩 문제' 카테고리의 다른 글
[LeetCode] 383. Ransom Note, C (0) | 2022.12.30 |
---|---|
[LeetCode] 876. Middle of the Linked List, C (0) | 2022.12.28 |
[백준] 체스판 다시 칠하기, 1018, C/C++ (0) | 2022.11.29 |
[백준] 유기농 배추, 1012, C (0) | 2022.11.28 |
[백준] 다리놓기, 1010, C (0) | 2022.11.25 |
Comments