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.
When you asked me, I didn't do it. Brute-force can pass all except 5 timeout, and I don't understand the killer array. However, after I did some Google and found this, I finished my code in around 20 lines in Python in half an hour. Take a try! Just push all elements once according to some conditions and pop some elements according to some conditions, and at the meantime, push the day that the plant will die with the plant, and also remember to trace the maximum day. Good luck!
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 →
Forget about the killer array... Read this(mjolka's Spoilers part): http://codereview.stackexchange.com/questions/104544/hacker-rank-poisonous-plants
When you asked me, I didn't do it. Brute-force can pass all except 5 timeout, and I don't understand the killer array. However, after I did some Google and found this, I finished my code in around 20 lines in Python in half an hour. Take a try! Just push all elements once according to some conditions and pop some elements according to some conditions, and at the meantime, push the day that the plant will die with the plant, and also remember to trace the maximum day. Good luck!