Codey and Toy Kingdom 2
https://www.hackerrank.com/contests/codenection-2024-final-round-closed-category/challenges/cn24-14
Question
Earlier, Codey built a toy kingdom with islands and bridges but soon realized it wasn’t the best way to construct a kingdom. To impress Zoey, Codey now wants to build an outstanding toy kingdom.
Therefore, Codey decided to rebuild the kingdom with n islands and m bridges, where each bridge connects two different islands. However, the kingdom might be disconnected and may contain redundant bridges.
Help Codey figure out how many bridges need to be burned and how many need to be built to ensure all islands are connected without any redundant bridges, so it can impress Zoey!
Input Format
The first line contains two integers, m and n, where n represents the number of islands, and m represents the number of bridges.
The following m lines contain two integers, u and v, which indicates the bridge between island u and v.
Constraints
It is guaranteed that there is no self loop & multiple edges for each test case.
Output Format
Output two integers, a and b in a single line separated by a space, where a represents the number of bridges need to be burned and b represents the number of bridges need to be built.
Sample Inputs:
Last updated

