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. Crab Graphs
  5. Discussions

Crab Graphs

Problem
Submissions
Leaderboard
Discussions
Editorial

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

  • csimpilimpihova1
    2 years ago+ 2 comments
    1. Find terminal nodes (leaf nodes are they called?) - They will be the nodes that have only one adjascent node.
    2. Find the direct parents of these nodes
    3. Out of point 2 find those direct parents which have more than T leaf nodes
    4. Substract from n (total number of vertices) the count of all standalone nodes, plus the sum of the excess leaf nodes from point 3.

    Ready.

    0|
    Permalink
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy