leetcode 1049 Last Stone Weight II(最后一块石头的重量 II)
摘要:``` 有一堆石头,每块石头的重量都是正整数。 每一回合,从中选出任意两块石头,然后将它们一起粉碎。假设石头的重量分别为 x 和 y,且 x & stones) { int sum = 0; for (int i = 0; i
阅读全文
posted @
2019-05-20 00:52
Beserious
阅读(918)
推荐(0) 编辑
leetcode 152. Maximum Product Subarray
摘要:Given an integer array nums, find the contiguous subarray within an array (containing at least one number) which has the largest product. 题意:求最大的连乘。 思
阅读全文
posted @
2018-07-11 21:06
Beserious
阅读(129)
推荐(0) 编辑
leetcode 650. 2 Keys Keyboard
摘要:Initially on a notepad only one character 'A' is present. You can perform two operations on this notepad for each step: Copy All: You can copy all the
阅读全文
posted @
2018-04-04 23:21
Beserious
阅读(202)
推荐(0) 编辑
leetcode 55. Jump Game
摘要:Given an array of non negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maxim
阅读全文
posted @
2018-04-03 13:39
Beserious
阅读(141)
推荐(0) 编辑
leetcode 309. Best Time to Buy and Sell Stock with Cooldown
摘要:Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may comple
阅读全文
posted @
2018-03-23 23:55
Beserious
阅读(145)
推荐(0) 编辑
leetcode 714. Best Time to Buy and Sell Stock with Transaction Fee
摘要:Your are given an array of integers prices, for which the i th element is the price of a given stock on day i; and a non negative integer fee represen
阅读全文
posted @
2018-03-23 23:47
Beserious
阅读(249)
推荐(0) 编辑
leetcode 32. Longest Valid Parentheses
摘要:Given a string containing just the characters and , find the length of the longest valid (well formed) parentheses substring. For , the longest valid
阅读全文
posted @
2018-03-21 21:24
Beserious
阅读(112)
推荐(0) 编辑
leetcode 338. Counting Bits
摘要:Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation and r
阅读全文
posted @
2018-03-12 20:36
Beserious
阅读(171)
推荐(0) 编辑
leetcode 795. Number of Subarrays with Bounded Maximum
摘要:We are given an array A of positive integers, and two positive integers L and R (L R`的数字,那么此时就重新开始计数。思路很简单,但是实现起来..... 代码中b维护的是`& A, int L, int R) { i
阅读全文
posted @
2018-03-08 18:57
Beserious
阅读(319)
推荐(0) 编辑
leetcode 198. House Robber
摘要:You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping yo
阅读全文
posted @
2018-02-28 15:15
Beserious
阅读(105)
推荐(0) 编辑
leetcode 790. Domino and Tromino Tiling
摘要:We have two types of tiles: a 2x1 domino shape, and an "L" tromino shape. These shapes may be rotated. XX
阅读全文
posted @
2018-02-25 19:03
Beserious
阅读(809)
推荐(0) 编辑
leetcode 97. Interleaving String
摘要:Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2. 第一个思路肯定可能就是递归了 class Solution { public: int mark = 0; void dfs(string& s
阅读全文
posted @
2017-12-29 23:10
Beserious
阅读(190)
推荐(0) 编辑
leetcode 746. Min Cost Climbing Stairs
摘要:Once you pay the cost, you can either climb one or two steps. You need to find minimum cost to reach the top of the floor, and you can either start fr
阅读全文
posted @
2017-12-17 13:39
Beserious
阅读(282)
推荐(0) 编辑
leetcode 416. Partition Equal Subset Sum
摘要: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
阅读全文
posted @
2017-10-20 14:00
Beserious
阅读(92)
推荐(0) 编辑
链家2018链习生招聘 编程题三
摘要:小明有n(1 using namespace std; int dp[2010][2010]; int main() { int n; while (cin n) { vector v(n); memset(dp, 0, sizeof dp); for (int i = 0; i v[i]; //
阅读全文
posted @
2017-09-03 17:07
Beserious
阅读(1230)
推荐(0) 编辑
leetcode 664. Strange Printer
摘要:There is a strange printer with the following two special requirements: Given a string consists of lower English letters only, your job is to count th
阅读全文
posted @
2017-09-02 13:44
Beserious
阅读(1197)
推荐(0) 编辑
leetcode 656. Coin Path
摘要:Given an array A (index starts at 1) consisting of N integers: A1, A2, ..., AN and an integer B. The integer B denotes that from any place (suppose th
阅读全文
posted @
2017-08-06 22:14
Beserious
阅读(883)
推荐(0) 编辑
70. Climbing Stairs
摘要:You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you cl
阅读全文
posted @
2017-07-20 18:05
Beserious
阅读(136)
推荐(0) 编辑
53. Maximum Subarray
摘要:Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array [-2,1,-3,4,-1,2,
阅读全文
posted @
2017-07-20 08:13
Beserious
阅读(117)
推荐(0) 编辑
HDU 1284 钱币兑换问题
摘要:钱币兑换问题 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 9699 Accepted Submission(s): 5898 Problem
阅读全文
posted @
2016-12-06 11:44
Beserious
阅读(239)
推荐(0) 编辑