自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(37)
  • 资源 (2)
  • 收藏
  • 关注

原创 linux 命令及shell 知识小点汇集

一、  linux 命令中,经常会用到对一个命令进行编辑的情况,为了提高工作效率,利用一些快捷键可以达到事半功倍的效果,以前常用的快捷键,多时不用,有些生疏了,在这里简单小节,以备查用。复现历史命令的快速方式1、向上箭头“↑”,可以复现上一条执行的指令2、! +abc,可以执行最近一条以abc开头的命令3、Crtl +r 可以查找历史命令4、history  N  |grep

2015-11-20 21:53:55 486

原创 Redis 设计与实现阅读笔记(一)

一、简单动态字符串(SDS)SDS通过使用一个结构如下:struct sdshdr {  int len;  int free;  char buf[];};    len是字符串长度,free是缓存区中的剩余大小,通过使用len记录字符串的长度,可以快速的实现字符串的长度获取,并且可以避免复制相关的操作的溢出。利用free实现对字符串存储空间的预分

2014-11-26 14:38:24 580

转载 使用gdb调试正在运行的程序

文章来源:http://wiki.ubuntu.org.cn/index.php?title=%E7%94%A8GDB%E8%B0%83%E8%AF%95%E7%A8%8B%E5%BA%8F&variant=zh-hans 一般来说GDB主要调试的是C/C++的程序。要调试C/C++的程序,首先在编译时,我们必须要把调试信息加到可执行文件中。使用编译器(cc/gcc/g++)的 -g 参数

2014-11-26 14:09:02 985

原创 leetcode Reverse Words in a String

本来想使用网上将的比较多的,先将整个xuli

2014-06-05 15:02:18 462

原创 leetcode Convert Sorted List to Binary Search Tree

该题将有序链表转为二叉查找树,通过类似有序数组的方法,

2014-05-19 20:19:30 688

原创 leetcode Largest Rectangle in Histogram

求解最大矩形,很容易想到O(n)

2014-05-19 19:48:31 578

原创 leetcode Valid Number

这道题目思路并不是很复杂,关键是iclass Solution {public: bool isNumber(const char *s) { const char *str=s; if(!str)return false;//空串 int tmp=0; int point=0; while(*str!

2014-05-15 20:04:35 641

原创 leetcode Unique Paths & Unique Paths II & Minimum Path Sum

这三题都是简单的动态规划题目,

2014-05-13 17:07:38 644

原创 leetcode Merge Intervals & Insert Interval

典型的贪心算法 bool compare(const Interval &a,const Interval &b){ return (a.start<b.start); }class Solution {public: vector merge(vector &intervals) { int len=intervals.size();

2014-05-13 16:56:10 735

原创 leetcode N-Queens & N-Queens II

dddbool iscan(int x,int y,vectormap){ for(int i=0;i<x;i++) for(int j=0;j<map[0].size();j++) if(map[i][j]=='Q'){ if(j==y||i+j==x+y||i-j==x-y)retur

2014-05-12 19:37:49 503

转载 leetcod Wildcard Matching

上来想到用递归求解,结果超时,先是考虑把多个连续的*合成一个*处理,仍然超时,最后在http://www.cnblogs.com/x1957/p/3517096.html处看到,可以通过类似回溯的方式

2014-05-12 16:25:19 828

原创 leetcode Best Time to Buy and Sell Stock I & II & III

Best Time to Buy and Sell Stock class Solution {public: int maxProfit(vector &prices) { int ans=0; if(prices.size()<=1)return 0; int tres=0; int len=prices.size(

2014-05-11 21:05:08 709

原创 leetcode Linked List Cycle & Linked List Cycle II

Linked List Cycle bool hasCycle(ListNode *head) { if(head==NULL||head->next==NULL)return false; ListNode *p=head,*q=head; while(p&&p->next){ q=q->next;

2014-05-11 20:18:39 580

原创 Spiral Matrix & Spiral Matrix II & Rotate Image

class Solution {public:    void rotate(vector > &matrix) {        int b=0,e=matrix.size()-1;        if(e        int tmp;        while(b            for(int i=0;i                   tmp=m

2014-05-10 19:31:08 625

原创 leetcode Jump Game & Jump Game II

class Solution {public:    bool canJump(int A[], int n) {        if(A[0]==0&&n!=1)return false;        for(int i=1;i             A[i]=max(A[i]+i,A[i-1]);             if(A[i]             

2014-05-10 18:35:40 510

转载 读《一个递归引发的思考》有感

——“码小农”第一期 首先,我想向阿里的凡提前辈表达诚挚的谢意,感谢前辈在百忙之中参与高校联盟的“码小农”活动,同时感谢集团技术发展部的高阳姐,多谢您从中沟通协调,保证本次活动顺利完成。以下涉及到凡提前辈本人的博文原文或解答等时,文字将被标记为蓝色,特此说明。 l  博文剖析 博文开始描述了凡提前辈遇到的一个需求:将某个路径作为参数传递给工具,然后工具可以遍历该目录下的所有

2014-05-10 16:37:58 622

原创 leetcode Permutations & Permutations II

sdfsdssdfvoid myf(vector &nu,vector num,bool cont[], vector >&res,int k){ num.push_back(k); if(num.size()==nu.size()){res.push_back(num);return ;} for(int i=0;i<nu.size();i++){

2014-05-10 14:41:48 509

原创 leetcode Valid Sudoku & Sudoku Solver

class Solution {public:    bool isValidSudoku(vector > &board) {        bool ish[10];        int len=board.size();        for(int i=0;i            memset(ish,0,sizeof(ish));            f

2014-05-09 19:23:56 581

原创 leetcode Combination Sum &Combination Sum II

void myf(vector > &res,vector &candidates, vectorre,int target,int i){    if (target==0) {res.push_back(re);return;}    if(target    int len=candidates.size();    for(;i    if(candidates[i]

2014-05-09 19:18:08 578

原创 leetcode Search in Rotated Sorted Array & Search for a Range & Search Insert Position

这三道题目都是二分查找的,

2014-05-08 16:47:44 651

原创 leetcdoe Next Permutation & longest Valid Parentheses

class Solution {public:    void nextPermutation(vector &num) {        int len=num.size();        if(len        int count=1;                int i;        for( i=len-1;i>0;i--){       

2014-05-08 16:25:49 722

原创 leetcode 第27-28 题 Implement strStr() & Divide Two Integers

class Solution {public:    char *strStr(char *haystack, char *needle) {        // Start typing your C/C++ solution below        // DO NOT write int main() function        int lena = strlen(h

2014-05-06 16:32:46 602

原创 leet code 第25-26题Remove Duplicates from Sorted Array & Remove Element

class Solution {public:    int removeElement(int A[], int n, int elem) {        if(n==0)return 0;        int len=n;        for(int i=0;i            if(A[i]==elem){                if(A[n-

2014-05-04 08:55:14 484

原创 leetcode 第22-24题Merge k Sorted Lists & Swap Nodes in Pairs & Reverse Nodes in k-Group

class Solution {public:    ListNode *swapPairs(ListNode *head) {        if(head==NULL)return head;        ListNode *p=head,*q=head->next,*r;        if(q==NULL)return head;         p->next=

2014-05-03 12:40:18 914

原创 leetcode 第20-21题 Valid Parentheses & Generate Parentheses

Valid Parentheses class Solution {public:    bool isValid(string s) {        stacktmps;        int len=s.size();        for(int i=0;i            if(s[i]=='('||s[i]=='['||s[i]=='{')

2014-05-03 12:19:49 590

原创 leetcode 第17-19题

class Solution {public:     vector > fourSum(vector &num, int target) {        int len =num.size();                 vector >ans;        ans.clear();         //cout        sort(num.beg

2014-05-02 12:00:34 704

原创 leetcode 第15-16题 3Sum & 3Sum Closest

3Sum这道题的思路可以将 2sum的思路进行扩展,即将3个数的和看成一个是tar

2014-05-01 14:02:07 471

原创 leetcode 第13-14题 Roman to Integer & Longest Common Prefix

class Solution {public:    string longestCommonPrefix(vector &strs) {        string ans="";                int len=strs.size();        if(len==0)return ans;        int count=strs[0].size

2014-04-30 10:24:49 487

原创 leetcode 第11-12题

string myf(int x,int num){    string ss="IVXLCDM";    string s="";    for(int i=0;i        s+=ss[x];    return s;}class Solution {public:    string intToRoman(int num) {         

2014-04-28 09:38:22 786

原创 leetcode 第10题 Regular Expression Matching

该题主要考正则表达式,需要迭代的去匹配,自然想到用递归,先考虑结束bi

2014-04-25 12:34:29 855

原创 leetcode 第9题 Palindrome Number

class Solution {public:    bool isPalindrome(int x) {        if(x        if(x>=0&&x        long long k=0;        long long y=x;        cout        while(x>0)        {              

2014-04-23 12:02:22 485

原创 leetcode 第6-8题

该题是个找规律题,每行的字符位置距离

2014-04-22 15:18:28 504

原创 leetcode 第5题 Longest Palindromic Substring

class Solution {public:    string longestPalindrome(string s) {        string res="";        if(s.size()        int n=s.size();        for(int i=0;i            string s1="",s2="";     

2014-04-19 21:00:16 754

原创 leetcode 第4题 Add Two Numbers

ListNode *myfunction(ListNode *l1, ListNode *l2,int dis) {       ListNode *p1=l1;       ListNode *p2=l2;       ListNode *p3=new ListNode(0);       ListNode *p4=p3;       int k=0;       whi

2014-04-18 17:43:30 630

原创 leetcode 第三题 Longest Substring Without Repeating Characters

queueque;//通过记录不重复部分的数据,每次发现重复,就踢出重复元素(前一个)前面的数据class Solution1 {public:    int lengthOfLongestSubstring(string s) {        int len = s.size();        int i = 0, j = 1;        int res =

2014-04-18 17:21:49 610

原创 leetcode 第二题 median of two sorted arrays

这题刚看时,确实没有认真对待,后来细做下来,一直没有比较高效的想法

2014-04-18 17:12:56 647

原创 leetcode 第一题 two sum

由于快要找工作,A的实习生挂了,让我多少

2014-04-18 17:01:02 868

编译原理上机报告(西安电子科技大学)

该报告是关于使用lex和yacc实现数据库的上机内容,包括代码和文本报告

2011-05-09

数字信号处理上机代码(西电)

改代码具有比较好的学习样例。其中根据西安电子科技大学的数字信号上机作业内容相匹配

2011-04-19

空空如也

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

TA关注的人

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