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.
mine was failing those cases when I used an array and object for frequencies and counts, but when I switched to 2 objects, it started passing ...that said, I am still failing 3 other edge case right now and I'm not sure why. Thanks for your post, it may help
it just dawned on me that you are checking for the value during a delete not just to prevent illegally going negative, but because it actually says "if present"! .. My solution here uses something similar to python's counter (naaomi_ngyuen7's solution above uses that, and since I came here for the final 3 cases I figured I could improve readability of mine with something similar):
Frequency Queries
You are viewing a single comment's thread. Return to all comments →
mine was failing those cases when I used an array and object for frequencies and counts, but when I switched to 2 objects, it started passing ...that said, I am still failing 3 other edge case right now and I'm not sure why. Thanks for your post, it may help
it just dawned on me that you are checking for the value during a delete not just to prevent illegally going negative, but because it actually says "if present"! .. My solution here uses something similar to python's counter (naaomi_ngyuen7's solution above uses that, and since I came here for the final 3 cases I figured I could improve readability of mine with something similar):