自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(11)
  • 资源 (5)
  • 收藏
  • 关注

原创 Minimum Height Trees | LeetCode

For a undirected graph with tree characteristics, we can choose any node as the root. The result graph is then a rooted tree. Among all possible rooted trees, those with minimum height are called mini

2015-11-30 14:38:12 1148

原创 Best Time to Buy and Sell Stock| LeetCode

题目很简单,就是给定一个数值,每个值代表每天的股价,如果最多交易一次的话(买入一次,卖出一次),求最大收益。这个生活中都知道,低入高出,必然可以得到高收益。解题思路:设定初始化买入为第一天,记为最小,往后扫,记录如果卖出的话,最大收益为多少,并已之前的记录作比较。代码很简洁,如下:  int maxProfit(vector& prices) {        int res=0;

2015-11-25 22:00:41 446

原创 Partition List | LeetCode 8ms C++Solution

Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x.You should preserve the original relative order of the nodes in each of

2015-11-24 19:51:14 280

原创 3Sum | LeetCode O(N*N) Solution

解题思路:如果是两个数加和等于target,那么我们很容易就想到O(n)的算法,这里题意是三个数的和等于target,其实就可以拆分为2Sum的问题,只是target‘=target-i;这里的I是枚举的第一个数,所以有算法复杂度为O(N*N)注意:保证结果是排序的,所以可以在一开始就将原数组排好序。另外为了避免重复,有两种解决方案:1)在求出所有结果之后,使用unique函数结合er

2015-11-23 20:41:47 347

原创 H-index II | LeetCode 12ms Solution

相对于第一题,这里提供的输入数组时已经排序的。解题思路:最简单的做法就是遍历,依次判断每一个位置的元素是否符合H-index 的定义,而且题目中给出了当出现多个值得时候,选取最大的。比如输入为【0,1,2,5,6】根据定义是至多h篇文章至少被引用h次。所以这里出现2,5其实都是符合条件的,这时候我们选取5,这样返回值就是2.又假设输入时【1,0,1,1,2,1】这里1,2都是符合条件的,我

2015-11-23 10:55:34 301

原创 Binary Tree Path | LeetCode

solution:vector binaryTreePaths(TreeNode* root) {        vector res;        if(root==NULL)            return res;        string path="";        helper(path,res,root);        return r

2015-11-22 23:36:26 346

原创 Basic Calculator II | LeetCode 48ms C++ Solution

Implement a basic calculator to evaluate a simple expression string.The expression string contains only non-negative integers, +, -, *, / operators and empty spaces . The integer division should

2015-11-22 22:33:43 337

原创 Maximum Product subarray | LeetCode

Find the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given the array [2,3,-2,4],the contiguous subarray [2,3] has the larges

2015-11-22 19:40:57 294

原创 Container Water | LeetCode

思路:每次宽度上减少一格,只要保证高度上的增加就可以弥补,这样代码中的while循环解答:int maxArea1(vector& height) {        int i=0,j=height.size()-1;        int water=0;        while(i            int h=min(height[i],height[j

2015-11-19 21:48:03 229

原创 Longest increasing subsequence |LeetCode

int lengthOfLIS1(vector& nums) {        if(nums.size()==0)            return  0;        vector res;        for(int i=0;i            auto it=lower_bound(res.begin(),res.end(),nums[i]);     

2015-11-19 14:22:04 338

原创 Additive Number | Leetcode

Additive number is a positive integer whose digits can form additive sequence.A valid additive sequence should contain at least three numbers. Except for the first two numbers, each subsequent num

2015-11-18 19:43:35 676

VLSI TEST PRINCIPLE AND ARCHITECTURE

vLsi test principle and architecture ,it is very useful for you to learn the point of hardware.

2014-09-22

挑战赛细则

想当梦想达人吗,如果想的话就快来参加由国际电器制造有想过给你说主板,中三大学城邦发开发高校挑战赛吧

2012-05-29

codeblocks

codeblocks,c++开发

2012-05-29

nvgative mysql

可视化管理使用Mysql,当前如果对于大部分的铜须的来说,要记住大量的命令,同时在命令行格式下使用操作数据库的话是有点点障碍的

2012-05-01

mysql教程pdf

mysql教程pdf,这是当前最流行的数据库管理开发技术,所以希望这些对大家有帮助

2012-01-08

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除