摘要:
Given an array *nums* containing *n* + 1 integers where each integer is between 1 and *n* (inclusive), prove that at least one duplicate number must exist. Assume that there is only one duplicate number, find the duplicate one. 阅读全文
posted @ 2019-06-26 16:07
yjxyy
阅读(148)
评论(0)
推荐(0)
摘要:
Given a positive integer *n*, find the least number of perfect square numbers (for example, `1, 4, 9, 16, ...`) which sum to *n*. 阅读全文
posted @ 2019-06-26 16:03
yjxyy
阅读(607)
评论(0)
推荐(0)
摘要:
Given a string containing just the characters `'('` and `')'`, find the length of the longest valid (well-formed) parentheses substring. 阅读全文
posted @ 2019-06-26 15:59
yjxyy
阅读(106)
评论(0)
推荐(0)
摘要:
Merge *k* sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 阅读全文
posted @ 2019-06-26 15:50
yjxyy
阅读(139)
评论(0)
推荐(0)
摘要:
There are two sorted arrays **nums1** and **nums2** of size m and n respectively.
Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). 阅读全文
posted @ 2019-06-26 15:02
yjxyy
阅读(155)
评论(0)
推荐(0)
摘要:
You are given a list of non-negative integers, a1, a2, ..., an, and a target, S. Now you have 2 symbols `+` and `-`. For each integer, you should choose one from `+` and `-` as its new symbol. 阅读全文
posted @ 2019-06-26 14:39
yjxyy
阅读(376)
评论(0)
推荐(0)
摘要:
Given a **non-empty** array containing **only positive integers**, find if the array can be partitioned into two subsets such that the sum of elements in both subsets is equal. 阅读全文
posted @ 2019-06-26 14:05
yjxyy
阅读(1024)
评论(0)
推荐(0)
摘要:
Suppose you have a random list of people standing in a queue. Each person is described by a pair of integers `(h, k)`, where `h` is the height of the person and `k` is the number of people in front of this person who have a height greater than or equal to `h`. Write an algorithm to reconstruct the queue. 阅读全文
posted @ 2019-06-26 14:00
yjxyy
阅读(123)
评论(0)
推荐(0)
摘要:
Given an encoded string, return it's decoded string. 阅读全文
posted @ 2019-06-26 13:49
yjxyy
阅读(172)
评论(0)
推荐(0)
摘要:
Given a non-empty array of integers, return the **k** most frequent elements. 阅读全文
posted @ 2019-06-26 13:37
yjxyy
阅读(440)
评论(0)
推荐(0)