自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(7)
  • 资源 (9)
  • 收藏
  • 关注

原创 Valid Anagram

方法1 先排序 后判断是否相等#include "stdafx.h" #include <algorithm> #include <string> using namespace std; class Solution { public: bool isAnagram(string s, string t) { sort(s.begin(), s.end());

2016-02-29 22:21:06 329

原创 binary-search-tree-iterator

https://leetcode.com/problems/binary-search-tree-iterator/ 利用非递归 中序遍历的思想class BSTIterator { private: stack<TreeNode*> s; public: BSTIterator(TreeNode *root) { while (!s.empty())

2016-02-29 21:24:42 418

原创 ntersection-of-two-linked-lists

https://leetcode.com/problems/intersection-of-two-linked-lists/ 由于链表的最后是合在一起的 所以在遍历的时候到末尾的长度一定相等的 假设两条链表的长度是m n m>n 方法是从短链表的头部 和 从长链表 距离链表尾部和短链表一样长的地方开始遍历 如果指向相同的地址就把这个地址返回x指向长链表的首部 y指向短链表的首部 x

2016-02-28 15:27:23 422

原创 Search in Rotated Sorted Array

采用二分的思路对于数组 二分之后只可能出现上图3种情况 对于每种情况 每次搜索原来范围的一半#include <iostream> #include <vector> using namespace std; class Solution { public: int search(vector<int>& nums, int target) { return searchb

2016-02-26 14:44:14 398

原创 Remove Duplicates from Sorted Array II

这也是一道去除重复元素的题目 但是允许重复的元素最多为2 在上一道题目的启发下 利用last来记录生成的数组的最后一个元素的下标 curnum为当前扫描的位置的下标 num记录重复的元素的个数 if (nums[checknum] != nums[last]) { num = 1; nums[++

2016-02-25 21:57:23 341

原创 Remove Duplicates from Sorted Array

#include <vector> using namespace std;class Solution { public: int removeDuplicates(vector<int>& nums) { if (nums.size() == 0) return 0; int last, checknum;//last为不重复数组的

2016-02-25 20:43:37 307

原创 largestBSTSubtree

#include "stdafx.h" #include <iostream> #include "limits.h" using namespace std;typedef struct treenode { struct treenode *l; struct treenode *r; int value; }TreeNode,*TreeNodePtr; bool res

2016-02-24 20:41:06 373

PID算法介绍

pid算法是用于反馈控制的算法 适合于工业控制

2012-10-07

数字电路教程

很好的数字电路入门资源,非常适合入门 数字电路是基础哦

2012-09-23

TMP100驱动

温度传感器TMP100的驱动代码,可以直接拿过来用的

2012-09-18

安卓开发门必读

安卓开发必读 Android

2012-05-13

空空如也

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

TA关注的人

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