摘要:
121. Best Time to Buy and Sell Stock Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitte 阅读全文
摘要:
procedure three-way-partition(A : array of values, mid : value): i ← 0 j ← 0 n ← size of A - 1 while j ≤ n: if A[j] < mid: swap A[i] and A[j] i ← i + 阅读全文
摘要:
很开心,自己想出来的一道题 There is a list of sorted integers from 1 to n. Starting from left to right, remove the first number and every other number afterward un 阅读全文
摘要:
169. Majority Element Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. Y 阅读全文
摘要:
137. Single Number II Given an array of integers, every element appears three times except for one. Find that single one. Note:Your algorithm should h 阅读全文