일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 31 |
- 개발자의 책장
- 재귀함수
- Programmers
- 알고리즘
- array.slice()
- Hackerrank
- Developer_JoyKim
- 블록체인
- select
- for문
- 프로그래머스
- 배열
- 코드스테이츠
- 역행자
- Where
- 코딩공부
- MySQL
- 개발자_조이킴
- 코딩테스트
- join
- JavaScript
- 코플릿
- 최강의 인생
- node.js
- array.push()
- Algorithms
- 정규표현식
- array
- SQL
- 자바스크립트
- Today
- Total
목록While (2)
CodingSpace
Problem. Implementation - Cut the sticks Link. https://www.hackerrank.com/challenges/cut-the-sticks/problem?isFullScreen=true Cut the sticks | HackerRank Given the lengths of n sticks, print the number of sticks that are left before each cut operation. www.hackerrank.com Description. You are given a number of sticks of varying lengths. You will iteratively cut the sticks into smaller sticks, dis..
Problem. powerOfTwo Description. 수를 입력받아 2의 거듭제곱인지 여부를 리턴하는 함수를 작성하시오. ※ while문 필수사용 입력: 인자1: num number 타입의 정수 (num >= 1) 출력: boolean 타입을 반환 My Answer. function powerOfTwo(num) { do { if(num === 1) return true; // 홀수이면, false 반환 else if(num % 2 !== 0) return false; // 짝수이고 1보다 크면, num을 2로 나눠서 재정의 else if(num % 2 === 0 && num > 1) num = num / 2; } while (num >= 1) // num이 1보다 크거나 같으면, while문 계속실..