본문 바로가기

기록

검색하기
기록
프로필사진 dev.jung

  • 분류 전체보기 (42)
    • Develop (3)
    • HTML (1)
    • JS (3)
    • React (7)
    • React Navtive (0)
    • Next (4)
    • Webpack (0)
    • Algorithm (24)
      • Programmers (23)
      • Codility (1)
Guestbook
반응형
Recent Posts
Recent Comments
Link
«   2025/07   »
일 월 화 수 목 금 토
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
Tags
  • programmers
  • Collapse
  • From
  • javascript
  • array
  • form
  • 상호 평가
  • component
  • MaterialUI
  • Challenge
  • nextjs
  • javscript
  • React
  • Weekly
  • redux-toolkit
  • HTML
  • algorithm
  • 리액트
  • Javasript
  • 직업군 추천하기
  • Weekly Challenge
  • solution
  • eslint
  • 폼
  • split
  • 알고리즘
  • js
  • next
  • Prettier
  • level1
more
Archives
Today
Total
관리 메뉴
  • 글쓰기
  • 방명록
  • RSS
  • 관리

목록Algorithm/Codility (1)

기록

[Lesson1] BinaryGap

문제 부터 2,147,483,647 사이의 숫자들 중에서 하나가 주어지면 그 숫자를 2진수로 변환했을때 1과 1 사이의 연속적인 0의 길이가 긴 길이를 리턴 풀이 function solution(N) { const binary = N.toString(2); const binaryGaps = binary.slice(binary.indexOf('1') + 1, binary.lastIndexOf('1')); if (!binaryGaps) { return 0; } const zeroArray = binaryGaps.split('1').map(zeros => zeros.length); return Math.max(...zeroArray) } binary -> 2진수binaryGaps -> 첫위치 1과 마지막 1 ..

Algorithm/Codility 2021. 6. 3. 11:49
Prev 1 Next

Blog is powered by kakao / Designed by Tistory

티스토리툴바