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.
My golang solution.... It doesn't pass all the test cases. Can anyone spot the logic error?
Thanks in advance
funcpoisonousPlants(p[]int32)int32{// Write your code herevardaysint32isDead:=make([]bool,len(p))varaPlantDiedboolaPlantDied=trueforaPlantDied{aPlantDied=falseforidx:=len(p)-1;idx>0;idx--{ifp[idx-1]<p[idx]&&!isDead[idx-1]{isDead[idx-1]=trueaPlantDied=true}else{continue}}days++}returndays}returndays}
Poisonous Plants
You are viewing a single comment's thread. Return to all comments →
My golang solution.... It doesn't pass all the test cases. Can anyone spot the logic error?
Thanks in advance
time complexity is probably too large.