Fork me on GitHub

Binary Watch

Description:

Consider a binary watch with 5 binary digits to display hours (00 - 23) and 6 binary digits to display minutes (00 - 59).

For example 11:26 is displayed as 01011:011010.

Given a number x, output all times in human-readable format “hh:mm” when exactly x digits are 1.

Input:

An integer x. (0 ≤ x ≤ 9)

Output:

All times in increasing order.

Sample input:

1

Sample output:

00:01
00:02
00:04
00:08
00:16
00:32
01:00
02:00
04:00
08:00
16:00

Combination Sum

Description:

Given a set of candidate numbers (C) and a target number (T), find all
unique combinations in C where the candidate numbers sums to T.

The same repeated number may be chosen from C unlimited number of
times.

Notice:

Combination Sum II

Description:

Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.

Each number in C may only be used once in the combination.

Notice:

Delete Digits

Description:
Given string A representative a positive integer which has N digits, remove any k digits of the number, the remaining digits are arranged according to the original order to become a new positive integer.

Find the smallest integer after remove k digits. N <= 240 and k <= N.

Example:

Browser Caching

Description:
When you browse the Internet, browser usually caches some documents to reduce the time cost of fetching them from remote servers. Let’s consider a simplified caching problem. Assume the size of browser’s cache can store M pages. When user visits some URL, browser will search it in the cache first. If the page is already cached browser will fetch it from the cache, otherwise browser will fetch it from the Internet and store it in the cache. When the cache is full and browser need to store a

Give My Text Back

Description:
题目1 : Give My Text Back

To prepare for the English exam Little Ho collected many digital reading materials. Unfortunately the materials are messed up by a malware.

It is known that the original text contains only English letters (a-zA-Z), spaces, commas, periods and newlines, conforming to the following format: