- 博客(9)
- 收藏
- 关注
原创 leetcode 300.Longest Increasing Subsequence(最长递增子序列) O(nlogn)算法
leetcode 300.Longest Increasing Subsequence(最长递增子序列) ,网上多是动态规划,复杂度为O(n^2)算法;本文设计一个O(nlogn)算法,即维护最小的最长子序列
2016-09-09 16:09:42
626
原创 leetcode 383. Ransom Note 勒索信
题目大意:勒索信(嗯,你没看错,勒索信,有没有吓哭) 给一串任意的勒索信字符串和另一串字符串包含从杂志上剪下来的字母,要求你写一个函数来返回是否勒索信是否由该杂志中字母组成,不是的话返回失败。 每一个杂志中的字母在你的勒索信中只能用一次。 注:你可以假设字符串都只包含小写字母。 背景介绍(作者瞎说的):大概因为美国绑匪勒索信都是从杂志上剪字母下来拼接而成(手写勒索信的话,可能被认出
2016-08-15 20:17:18
798
原创 小白学编程:最简单的web文件下载
【小白学编程,本文适合对这个技术一窍不通的人,技术大神请轻喷......】 新手(小白)学web编程前端时,常常不明白下载怎么弄,网上还没什么看得懂的教程(因为我是小白嘛,当然看不懂)。其实简单的下载很简单,直接浏览器解释即可(超链接指该文件名即可)。本文写的是,前端小白也能看懂的文章。看不懂,学不会,你找我!
2016-08-08 15:25:57
595
原创 leetcode 343.Integer Break 整数分割(c++)
Given a positive integer n, break it into the sum of at least two positive integers and maximize the product of those integers. Return the maximum product you can get. For example, given n = 2, ret
2016-04-28 17:02:19
634
原创 leetcode 338:Counting Bits 数1,C++
题目: 刚刚写了一篇有分析的,然而。。。。上传失败,我的小心灵很受伤,决定直接发代码.....有空再写完整版的分析.....简单来说,就是 一个数X的1的个数(countBit(X)),满足 countBit(X)=countBit(2^N)+countBit(X-2^N),用迭代,复杂度O(n) class Solution { public: vector countB
2016-03-26 19:36:36
295
原创 leetcode 338 Counting Bits【leetcode新题】 数11,C++
leetcode 338 Counting Bits【leetcode新题】 数11,C++
2016-03-26 17:17:14
498
原创 leetcode 337:House Robber III
leetcode 337:House Robber III。leetcode新题,递归的动态规划
2016-03-16 17:11:00
674
原创 leetcode 122. Best Time to Buy and Sell Stock II 股票买卖最佳时间(二)
题目: 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 complete as many transactions as you like (i
2016-03-13 17:49:39
627
原创 leetcode 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 permitted to complete at most one transaction (ie, buy one and sell one share of the
2016-03-13 17:32:08
1308
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人