Skip links

  • Skip to primary navigation
  • Skip to content
  • Skip to footer
오히려 좋아
  • Paper Review
  • ETC
  • Study
  • Kaggle
  • Programmers

    Gang Min

    꾸준히 기록하는 블로그.

    • Korea

    콜라츠 추측_프로그래머스_파이썬

    • 나의 풀이
    def solution(num):
        count = 0
        while num>1:
            if num%2== 0:
                num = num/2
                count+=1
            elif num%2==1:
                num = num*3+1
                count+=1
            if count == 500:
                break
                
        if count == 500:
            return -1
        else:
            return count
    

    Tags: programmers, python3, 추측, 콜라츠

    Categories: programmers

    Updated: April 28, 2021

    Twitter Facebook LinkedIn
    Previous Next

    Comments

    You May Also Enjoy

    추천시스템 함수

    song recommendation system

    TBS크롤링

    tbs

    MBC크롤링

    mbc

    2021 국토교통 빅데이터 온라인 해커톤 경진대회

    code

    • Feed
    © 2021 Gang Min. Powered by Jekyll & Minimal Mistakes.