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
  • Hiring developers?
  1. Prepare
  2. Algorithms
  3. Greedy
  4. Team Formation
  5. Discussions

Team Formation

Problem
Submissions
Leaderboard
Discussions
Editorial

Sort 78 Discussions, By:

recency

Please Login in order to post a comment

  • thecodingsoluti2
    2 months ago+ 0 comments

    Here is problem solution - https://programs.programmingoneonone.com/2021/07/hackerrank-team-formation-problem-solution.html

    0|
    Permalink
  • Tritonal
    5 months ago+ 0 comments

    This is the lousiest explanation possible. At its core it is a mathematical problem and they attempt to present it like a real-world issue. The problem is they've dressed it up as little more than lip stick on a pig. It's manifestly obvious the lip stick isn't helping describe or understand this problem.

    The explanation presents like they want you to form an elite team, but then the output of the first test case contradicts this. Evidenced by the first test case having a team chocked full of low skill set members - all negative numbers. What is this bullock, " largest smaller team size though"? It's a clear clash of terms "largest smaller." What?!#$? Largest in what sense?

    0|
    Permalink
  • 9087pranav
    1 year ago+ 0 comments

    the question was pretty hard but can be solved by maintaining a hashmap of the max element and a multiset of the max lengths for that element.

    0|
    Permalink
  • TChalla
    2 years ago+ 0 comments

    Python3 solution

    # Enter your code here. Read input from STDIN. Print output to STDOUT
    import heapq
    import sys
    
    for _ in range(int(sys.stdin.readline())):
        t = list(map(int, sys.stdin.readline().split()))
        n = t[0]
        if n == 0:
            print(0)
            continue
        a = sorted(t[1:])
        heap = {}
        for x in a:
            if x not in heap:
                heap[x] = []
            if x - 1 in heap and len(heap[x - 1]) > 0:
                heapq.heappush(heap[x], heapq.heappop(heap[x - 1]) + 1)
            else:
                heapq.heappush(heap[x], 1)
        print(min(heap[x][0] for x in heap if len(heap[x])))        
    
    0|
    Permalink
  • tanyaolivarez
    2 years ago+ 0 comments

    Can you please explain with the help of example ? spell to break up a relationship

    0|
    Permalink
Load more conversations

Need Help?


View editorial
View top submissions
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy