일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- coding
- 프로그래머스
- time complexity
- import re
- Stack
- CodingTest
- Level2
- 연습문제
- collections
- 완전탐색
- lambda
- lv4
- 시간복잡도
- BFS
- coding test
- python
- 코테
- 파이썬
- programmers
- 데이터분석
- 코딩테스트
- mysql
- itertools
- join
- Queue
- level4
- 조합
- sql
- 코딩
- counter
- Today
- Total
목록bin (1)
ror_coding
[Programmers] 점프와 순간 이동 - 12980
2로 나눠갈 때 홀수인 경우를 bin().count('1')로 구한다.. 천잰가..? Question 아이언 슈트 구매자는 아이언 슈트를 착용하고 거리가 N 만큼 떨어져 있는 장소로 가려고 합니다. 단, 건전지 사용량을 줄이기 위해 점프로 이동하는 것은 최소로 하려고 합니다. 아이언 슈트 구매자가 이동하려는 거리 N이 주어졌을 때, 사용해야 하는 건전지 사용량의 최솟값을 return하는 solution 함수를 만들어 주세요. Code (After) def solution(n): answer = 0 while n > 0: answer += n%2 n = n//2 return answer Code 1 : bin() 으로 홀수일 때 count. def solu..
Algorithm/Python
2024. 10. 28. 17:11