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. Graph Theory
  4. Tripartite Matching
  5. Discussions

Tripartite Matching

Problem
Submissions
Leaderboard
Discussions
Editorial

Sort 14 Discussions, By:

recency

Please Login in order to post a comment

  • yashparihar729
    2 weeks ago+ 0 comments

    Here is my solution in java, javascript, python, C, C++, Csharp HackerRank Tripartite Matching Problem Solution

    0|
    Permalink
  • mineman1012221
    2 months ago+ 0 comments

    Here is the solution of Tripartite Matching Click Here

    0|
    Permalink
  • thecodingsoluti2
    4 months ago+ 0 comments

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

    0|
    Permalink
  • bhautikbhalala41
    11 months ago+ 1 comment

    https://zeroplusfour.com/tripartite-matching-hackerrank-solution/

    Here's how I did in all languages Java 8 , C++ , C , Python 3, Python 2.

    0|
    Permalink
  • TChalla
    2 years ago+ 0 comments
    import sys
    
    def main():
        N = int(sys.stdin.readline())
        M = []
        G = []
        for i in range(3):
            M.append(int(sys.stdin.readline()))
            G.append([set() for _ in range(N)])
            for _ in range(M[i]):
                u, v = map(int, sys.stdin.readline().split())
                u, v = u - 1, v - 1
                G[i][u].add(v)
                G[i][v].add(u)
        cpt = 0
        for a in range(N):
            for b in G[0][a]:
                for c in G[1][b]:
                    if a in G[2][c]:
                        #print a,b,c
                        cpt += 1
        print(cpt)
    
    main()
    
    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