I am trying to solve the question 3d structure on hackerblock.
https://hack.codingblocks.com/app/practice/2/632/problem
please tell me why my code is giving me error
Approach i used to solve it is that i create a hashmap which will contain x,y,z as key and its update value as it value and when a query is given ,we search in the map whether the coordinate is present in between the coordinates of query.If yes ,include it.
Error in poblem 3d structure
@TusHar-AroRa-2294450460870717 hey your logic is incorrect . You need to solve this question using fenwick tree.
How is it incorrdect.Please explain.
I stored the updated values in the list and whenever a query comes,i check out whether the coordinates of list lie the range of query coordinates or not.If it lies,then add it to the sum.
Finally i printed the sum
@TusHar-AroRa-2294450460870717
yes you are right you logic is correct. i have corrected and simplified your code.
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.