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.
not very efficient though...
worst case if there are 10^5 apples and oranges that all fall within the house, then you are just creating and recreating (twice- once for each fruit) an array that is being extended by one cell one at a time (or by some random buffer decided on by the python sdk) 10^5 times instead of just immediately incrementing a single value without any memory allocations.
I would expect this to ime out on longer inputs.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Apple and Orange
You are viewing a single comment's thread. Return to all comments →
not very efficient though... worst case if there are 10^5 apples and oranges that all fall within the house, then you are just creating and recreating (twice- once for each fruit) an array that is being extended by one cell one at a time (or by some random buffer decided on by the python sdk) 10^5 times instead of just immediately incrementing a single value without any memory allocations. I would expect this to ime out on longer inputs.