There are 4 kids). So 1, 2, 3 are connected into a circle. There is no place
for the remaining 4-th)
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this gr
I wondered that too...seems kid 3 gets too many wishes
On Jan 8, 8:21 pm, bhawana goel wrote:
> In the 3rd test case, how come the answer is Yes. 1,2 and 3 are
> forming a cycle.
>
> On Jan 8, 1:19 pm, juver++ wrote:
>
>
>
>
>
>
>
> > Also, you may use hash_set and hash_map if such exists in you
In the 3rd test case, how come the answer is Yes. 1,2 and 3 are
forming a cycle.
On Jan 8, 1:19 pm, juver++ wrote:
> Also, you may use hash_set and hash_map if such exists in your language.
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To
Also, you may use hash_set and hash_map if such exists in your language.
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks
Use map > whichs maps vertex and all its neighbors.
You should use bfs only to find if there is cycle (with a shape of circle).
set is useful to keep track of visited vertices.
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this g
Hi.. thanks for your response.
The number of kids:
3 <= K <= 10^9
I cant declare an array: long long A[10];
and how does dfs or bfs finds the components of the graph?
because i have to verify if there is a cycle in all the components.
--
You received this message because you are subscr
Just got AC for this problem. Here is simple solution:
1. Calculate degree for each vertex. If there is a degree > 2, then answer
is No.
You may use hash_map or map here.
2. So at this step we don't have any verticies with 3 and more edges, only
<= 2 are allowed.
Though, we should check if there