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.
- Ice Cream Parlor
- Discussions
Ice Cream Parlor
Ice Cream Parlor
Sort by
recency
|
80 Discussions
|
Please Login in order to post a comment
why does O(N^2) pass with 100%?
The problems that have more than one "trip to the icream" per test case are effing BS. Shoving more than one assert into a test case is a horrific antipattern. And having to sort this sht out here with no debugger and the output going to god knows where effing sucks. I wouldn't give a sht except job interviews make me go to this stupid site. Ef you, authors, for shoving more than one test case into a test. Seriously.
Javascript Solution
}
I'll never understand the HackerRank trend of posting solutions in the discussion section let alone uncommented and unexplained solutions.
My thoughts: * I considered a two-pointer solution but the array isn't pre-sorted so this would require a sort which adds n * log(n) or a custom sort/search
Alternatively, you can use memoisation (collect some info while traversing for later). You need to think about the complement of the current price and available money.
Don't forget that the array isn't unique, just the solution