We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • HackerRank Home

    HackerRank

  • |
  • Prepare
  • Certify
  • Compete
  • Apply
  • Hiring developers?
  1. Prepare
  2. Algorithms
  3. Implementation
  4. Cut the sticks
  5. Discussions

Cut the sticks

Problem
Submissions
Leaderboard
Discussions
Editorial
Topics

    You are viewing a single comment's thread. Return to all comments →

  • boyananavadeep56
    4 months ago+ 0 comments

    python

    def cutTheSticks(arr):
        f=[]
        while True:
            f.append(len(arr))
            m=min(arr)
            for i in range(len(arr)):
                arr[i]=arr[i]-m
            for j in range(len(arr)):
                try:
                    l=arr.index(0)
                    arr.pop(l)
                except:pass
            if len(arr)<1:
                break
        return f
    
    0|
    Permalink
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy