@12GitTho10
Question is asking for longest path which has same node value
combine both left and right
so the path is
leftmost 4 -> middle 4 -> right down 4
as all node values is 4 we have to consider all
Hope this will help.
@12GitTho10
Question is asking for longest path which has same node value
combine both left and right
so the path is
leftmost 4 -> middle 4 -> right down 4
as all node values is 4 we have to consider all
Hope this will help.
@cheesewraps
Count number of edges and not number of nodes. 2 is correct answer here.
second last line, why do you need + res at the end?
it looks like you are adding emty string at the end ? but in a loop res will change, so in second iteration you will not get empty string? please let me know if you need it for specific reason.
for (String dir : stack) res = "/" + dir + res;