292.Nim Game

You are playing the following Nim Game with your friend:

  • Initially, there is a heap of stones on the table.
  • You and your friend will alternate taking turns, and you go first.
  • On each turn, the person whose turn it is will remove 1 to 3 stones from the heap.
  • The one who removes the last stone is the winner.
Read more »

290.Word Pattern

Given a and a string , find if follows the same pattern.

Here follow means a full match, such that there is a bijection between a letter in and a non-empty word in .

Read more »

283.Move Zeroes

Given an integer array , move all ‘s to the end of it while maintaining the relative order of the non-zero elements.

Note that you must do this in-place without making a copy of the array.

Read more »

278.First Bad Version

You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality check. Since each version is developed based on the previous version, all the versions after a bad version are also bad.

Suppose you have versions and you want to find out the first bad one, which causes all the following ones to be bad.

Read more »