Closed Uni-Bo closed 3 months ago
Winston Tang commented: Hello Debanjan_Konar_0408,
Thank you for reaching out. We understand that you're finding it challenging working with this problem. However, after thoroughly analyzing your concern, it seems the difficulty results from a misunderstanding in your code. The issue you're experiencing arises by assuming the 'edges' vector will always have at least three elements, which is not guaranteed by the problem constraints. Therefore, your code may induce an out-of-bounds error, as seen in test case 59/60
. Please reassess your logic and assumptions for the code and try again. Remember, the constraints mentioned in the problem statement guide you on how to generalize your solution for any valid input. Good luck, and keep practicing! Should you have any other questions or need further clarification, don't hesitate to ask.
Best Regards,
LeetCode Support Team
LeetCode Username
Debanjan_Konar_0408
Problem Number, Title, and Link
Bug Category
Incorrect test case (Output of test case is incorrect as per the problem statement)
Bug Description
Given Constraints:
3 <= n <= 105
edges.length == n - 1
edges[i].length == 2
1 <= ui, vi <= n
ui != vi
The given edges represent a valid star graph.
are not valid for test case59/60
Language Used for Code
C++
Code used for Submit/Run operation
Expected behavior
should provide an output for every case that has n>=3. but test case
59/60
has values:edges=[[1,3],[3,2]]
. which gives a heap-buffer-overflow errorScreenshots
Additional context
No response