## Climbing the Leaderboard

Solutions This problem has two main solutions. The first fully exploits the structure of the constraints, the second is more general. Tradeoffs of both: we remove all the duplicates. In a different context this could be forbidden and then we would have to use extra space or another logic; we don’t really change the score table. Instead, in a real game it’s very likely that we need to update the current scores (e. [Read More]

## New Year Chaos

Solutions We can see, intuitively, that the number of people a person $$p$$ has bribed corresponds to the number of people on her right with value less than $$p$$. For instance: 1 1 2 3 5 4 In this case, $$5$$ has bribed $$4$$ and took her position. Another example: 1 2 1 5 3 4 We have three bribes: $$2$$ has bribed $$1$$ $$5$$ has bribed $$4$$ $$5$$ has bribed $$3$$ This problem is equivalent to calculating the number of inversions of the array, that is the number of elements that are out of the natural order of a sequence. [Read More]
{"ft_lang_label":"__label__en","ft_lang_prob":0.92378604,"math_prob":0.99949646,"size":453,"snap":"2022-40-2023-06","text_gpt3_token_len":98,"char_repetition_ratio":0.075723834,"word_repetition_ratio":0.0,"special_character_ratio":0.200883,"punctuation_ratio":0.101123594,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9915056,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2022-10-05T21:56:51Z\",\"WARC-Record-ID\":\"<urn:uuid:cd538081-c16a-46ce-8c68-5142b7a770ed>\",\"Content-Length\":\"10398\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:627cbb3b-ff02-4574-905a-910249fedf27>\",\"WARC-Concurrent-To\":\"<urn:uuid:a35bc78f-dd65-4c1c-8788-e29932b3d757>\",\"WARC-IP-Address\":\"35.185.44.232\",\"WARC-Target-URI\":\"https://coding-gym.org/tags/sorted-sequence/\",\"WARC-Payload-Digest\":\"sha1:XWAWE76CZBMZ7WRYFFMK4KT3WFF7N3AX\",\"WARC-Block-Digest\":\"sha1:DBZNRBDC5CWV3VRAK6LFYAOHKPL6DTW6\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2022/CC-MAIN-2022-40/CC-MAIN-2022-40_segments_1664030337668.62_warc_CC-MAIN-20221005203530-20221005233530-00483.warc.gz\"}"}