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.
here, I can't figure out the difference between the two conditions "grandChildren != null" and "!grandChildren.isEmpty()"
both appear similiar to me but if I OR them instead of AND,obviously it produces wrong output...can you please explain them??
Thanks in advance!!
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Java Visitor Pattern
You are viewing a single comment's thread. Return to all comments →
@rshaghoulian..clear solution and easy to understand... I have a doubt that there is no need to remove the reverse edges if we skipped adding them...
(i.e) if we skip this segment
we need not do this..
But if skip the above lines,it produces wrong output.Can u please explain this??
and one more thing..
boolean childHasChild = (grandChildren != null && !grandChildren.isEmpty());
here, I can't figure out the difference between the two conditions "grandChildren != null" and "!grandChildren.isEmpty()" both appear similiar to me but if I OR them instead of AND,obviously it produces wrong output...can you please explain them??
Thanks in advance!!