Bishu and his girlfriend(Hackerearth) Runtime error! (SOLVED)

Question link : Bishu and his girlfriend

My code : Code

My code gives me Runtime Error - SIGSEGV, Can anybody tell me, what am I doing wrong !
Thanks.

You have to assign the size of visited vector before using it through indexes.

1 Like

Thanks man, Got AC finally.