https://ide.codingblocks.com/s/199580 is my code id .
Getting test case write but on submisson all are showing wrong. please tell the mistake
Getting wrong answer in kquero
@Adarshrajpandey
Line 14
You forgot to do j<=(treeseg[2index+1].size()-1)
You did j<=(treeseg[2index+1].size())
https://ide.codingblocks.com/s/199580 have made the change as u suggested but still getting the wrong answer
@Adarshrajpandey
In lower bound function
Think what happens when K is present in the array and when it is not present in the array and what will be returned as result in each case
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.
sir i am not able to understand thar thing please correct that in code
@Adarshrajpandey,
Try this:
-
Line 48:
return (treeseg[index].size() - (lower_bound(treeseg[index].begin(), treeseg[index].end(), k) - treeseg[index].begin())); -
Correction:
return treeseg[index].end()-upper_bound(treeseg[index].begin(), treeseg[index].end(), k);
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.