로딩
요청 처리 중입니다...

Codility Iterations : BinarayGap Java (코딜리티 자바로 풀었다)

 Codility Iterations : BinarayGap Java (코딜리티 자바로 풀었다)

Codility를 풀어보려고 한다 Lesson 1 Iterations - BinaryGap Find longest sequence of zeros in binary representation of an integer. 첫 번째 문제 ~ 영어다. 10진 법의 수를 2진 법의 수로 변환한 후 1 사이에 있는 0의 개수를 출력하는 solution을 작성하면 된다.

단, 두 개의 gap이 있는 경우에는 길이가 긴 gap의 개수를 출력하면 된다. 아래 예시를 보면 아주 빠르게 이해할 수 있다. input (9) -> 1001 -> output (2) input (529) -> 1000010001 -> output (4) input (20) -> 10100 -> output (1) input (15) -> 1111 -> output (0) class Solution { public int solution(int N) { String bi = Integer.toBinaryString(N); Li...

# codility # 자바 # 코딜리티 # 코딩테스트