Nodes at a distance k from the target node

can you please let me know where my code is lagging

@rahul.aggarwal000005
There are two mistakes in your code

  1. line 65 should be printkDown(root->right,k-l-1); You have to go right side of root
  2. You have missed the case when there is no such node, in that case you’ve to print “0”. Just write if(v.size()==0){ cout<<“0”<<endl; continue; } after line 101

Your code will work fine.