[LeetCode] Reveal Cards In Increasing Order

950. Reveal Cards In Increasing Order

You are given an integer array deck. There is a deck of cards where every card has a unique integer. The integer on the ith card is deck[i].

You can order the deck in any order you want. Initially, all the cards start face down (unrevealed) in one deck.

You will do the following steps repeatedly until all cards are revealed:

  1. Take the top card of the deck, reveal it, and take it out of the deck.
  2. If there are still cards in the deck then put the next top card of the deck at the bottom of the deck.
  3. If there are still unrevealed cards, go back to step 1. Otherwise, stop.

Return an ordering of the deck that would reveal the cards in increasing order.

Note that the first entry in the answer is considered to be the top of the deck.

Read more
[LeetCode] Super Washing Machines

517. Super Washing Machines

You have n super washing machines on a line. Initially, each washing machine has some dresses or is empty.

For each move, you could choose any m (1 <= m <= n) washing machines, and pass one dress of each washing machine to one of its adjacent washing machines at the same time.

Given an integer array machines representing the number of dresses in each washing machine from left to right on the line, return the minimum number of moves to make all the washing machines have the same number of dresses. If it is not possible to do it, return -1.

Read more
[AtCoder] E - (∀x∀)Read more
[AtCoder] D - ABC TransformRead more
[AtCoder] C - 1111gal passwordRead more
[AtCoder] E - Edge DeletionRead more
[AtCoder] D - Moves on Binary TreeRead more
[AtCoder] C - Collision 2Read more
[Codeforces] Round #676 (Div. 2) C. PalindromifierRead more
[Codeforces] Round #662 (Div. 2) B. Applejack and StoragesRead more