We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
This means we have a 3D cuboid with 0 and 1 on the X direction, 0, 1, 2 on the Y direction and 0, 1, 2, 3 on the Z direction. These are a total of 2 x 3 x 4 nodes. At each of theese nodes we have to check if the sum of the node indices is equal to N. If it is not equal to N we will add this list to the list of nodes. E.g. if we look at the note (0, 0, 0) the sum of all the indices is equal to 0 which is clearly not equal to N = 4. Hence we append this node to our list and get [[0, 0, 0]]. Then we procede until we have checked every possible combination.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
List Comprehensions
You are viewing a single comment's thread. Return to all comments →
I think they want us to get four inputs e.g.
1 # X
2 # Y
3 # Z
4 # N
This means we have a 3D cuboid with 0 and 1 on the X direction, 0, 1, 2 on the Y direction and 0, 1, 2, 3 on the Z direction. These are a total of 2 x 3 x 4 nodes. At each of theese nodes we have to check if the sum of the node indices is equal to N. If it is not equal to N we will add this list to the list of nodes. E.g. if we look at the note (0, 0, 0) the sum of all the indices is equal to 0 which is clearly not equal to N = 4. Hence we append this node to our list and get [[0, 0, 0]]. Then we procede until we have checked every possible combination.