how do i make it print ‘0’ if there is no node at a distance k?
Consider this case:
4
60 65 50 70
50 65 60 70
2
65 3 //////////////
60 1
how do i make it print ‘0’ if there is no node at a distance k?
Consider this case:
4
60 65 50 70
50 65 60 70
2
65 3 //////////////
60 1
@Karanveer as you have to print in sorted order store the answer in a vector and when displaying if v.size()==0 cout 0
for help refer this
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.