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.
Can you (or anyone else) please explain why Pair.count instance variable is necessary?
I'm sure it is necessary, because I can pass most but not all test cases with a similar solution that uses a Stack of just the Integer values of poison on plants (not tracking Pair.count).
So I am guessing that using Pair.count as you do would probably pass my failing test cases - but I cannot figure out what the plant poison number pattern is of the failing cases, which presumably Pair.count would account for. Can you please explain what the pattern is of test cases that Pair.count is necessary for?
Thank you!
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Poisonous Plants
You are viewing a single comment's thread. Return to all comments →
Thank you for this solution!
Can you (or anyone else) please explain why Pair.count instance variable is necessary? I'm sure it is necessary, because I can pass most but not all test cases with a similar solution that uses a Stack of just the Integer values of poison on plants (not tracking Pair.count). So I am guessing that using Pair.count as you do would probably pass my failing test cases - but I cannot figure out what the plant poison number pattern is of the failing cases, which presumably Pair.count would account for. Can you please explain what the pattern is of test cases that Pair.count is necessary for?
Thank you!