heres is the link to the problem

actually i am not able to understand the question

please if anyone can help me with it

Thanks

heres is the link to the problem

actually i am not able to understand the question

please if anyone can help me with it

Thanks

1 Like

You have to find maximum length of rope that connects the dots. More formally you should find longest sequence of adjacent dots. Its a very basic graph problem.

For the second input case it can either be 2,2 -> 3,2 -> 4,2 -> 5,2 -> 5,3 -> 5,4 -> 4,4 -> 3,4 -> 2,4 or 2,2 -> 3,2 -> 4,2 -> 5,2 -> 5,3 -> 5,4 -> 5,5 -> 5,6 -> 4,6 where 1,1 is the very first # and 6,7 is the last #.

How is the length of rope 8 ?

There are nine dots to connect and for every two adjacent dots length of rope required is 1 hence 8. As you can see the number of ->s in my above comment