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.
- New Year Chaos
- Discussions
New Year Chaos
New Year Chaos
Sort by
recency
|
25 Discussions
|
Please Login in order to post a comment
Python - the key for me was to think about 'how many people to the right have numbers smaller than me' as those people must have been overtaken (bribed). Then it became a matter of doing the check in a fast enough way to handle the test cases...
C#
Hint 1: Start from the end of the list.
Hint 2: Count swaps.
Hint 3: Swap values until they are in the "correct / original" place in line before bribes.
JS
C# solution to reverse the bribes and count them: