自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(12)
  • 收藏
  • 关注

原创 leetcode学习笔记5

205. Isomorphic StringsGiven two strings s and t, determine ifthey are isomorphic. Two strings are isomorphic if thecharacters in s can be replaced to get t. All occurrences of a character m

2016-02-05 20:02:19 187

原创 深度优先算法

从N个箱子放n个卡片的问题,理解深度优先算法int a[99],book[99],n;void dfs(int step){         inti;         if(step==n+1)         {for(i=1;i           cout                    }         for(i=1;i        

2016-02-02 20:12:02 225

原创 c++指针和存储空间的tips

一、指针的危险指针被创建时,程序为其随机分配地址,这是很隐蔽的bug。有指针一定要手动为其分配地址!!二、new来分配内存new将找到一个长度正确的内存块,并返回该内存块的地址,int *p=new int;三、使用delete需要内存时可以用new来申请,用delete来释放。Int *p= new int;Delete p;使用delete需要注意以下几点:

2016-02-02 15:21:59 189

原创 leetcode学习笔记4

Symmetric TreeGiven a binarytree, check whether it is a mirror of itself (ie, symmetric around its center).For example,this binary tree is symmetric:    1   /\ 2   2 / \/ \3  44  3

2016-02-02 15:20:23 232

原创 leetcode学习笔记3

Factorial Trailing ZeroesGiven an integer n,return the number of trailing zeroes in n!.Note: Yoursolution should be in logarithmic time complexity.class Solution {public:    int trailingZero

2016-02-02 15:10:28 154

原创 leetcode学习笔记2

MinimumDepth of Binary TreeMySubmissionsQuestionTotal Accepted: 91120 TotalSubmissions: 302986 Difficulty: EasyGiven a binarytree, find its minimum depth.The minimumdepth is the number of no

2016-02-02 14:57:25 186

原创 leetcode学习笔记1

Lowest Common Ancestor of a Binary Search TreeGiven a binary search tree(BST), find the lowest common ancestor (LCA) of two given nodes in the BST.According to the definition of LCA on Wikipedia:“

2016-01-26 20:43:55 188

原创 c++ study diary5

16.1.25一、对象的动态建立和释放使用new和delete,动态分配和撤销内存。例如:new box在此空间中存放一个box类对象,同时调用该类的构造函数,以使该对象初始化。但用户无法访问因为此对象无对象名,用户也不知道地址。Box *pt;Pt=new box;\\在pt中存放新建对象的起始地址二、对象的赋值和复制①对象的赋值Student stud1,s

2016-01-25 13:59:04 157 1

原创 c++ study diary4

16.1.24一、调用构造函数与析构函数的顺序先构造的后析构,后构造的先析构(类似于栈)。二、对象数组数组不仅可以有简单对象组成,也可以由类对象组成。如:Student stud[3];如果数组有多个实参,可以如下定义Student stud[3]={student(1001,18,87),student(1002,19,76),student(1003,78,72

2016-01-24 19:58:10 205

原创 c++ diary3

16.1.22一、函数的重载在类中具有相同的函数名,不同的参数个数和参数类型,这称为重载。例如:#include#include#include#include#includeusing namespace std;class box{         public:                   box();             

2016-01-24 12:56:30 251

原创 c++ study diary2

16,1,21Part1:typedf声明新类型1、  typedf用作名字替换如:typedef int integer,typedf float real2、  typedf声明结构体类型如:typeder struct{Int month;Int day;Int year;}DATE;3、  typedf声明新的函数类型如:typedf int N

2016-01-21 21:40:44 253

原创 c++ study diary1

16,1,20一、枚举类型enum 函数类型名{函数形参}。可用函数类型名来定义变量例如:Ensum color{black ,white,red};Color r;setw(int n),用来控制字符间距例1:口袋中有红、黄、蓝、白、黑5种颜色的球若干。每次从袋中任意取出3个球,问得到3种不同颜色的球的可能取法,输出每种排列情况。#include#incl

2016-01-21 08:24:02 308

空空如也

空空如也

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

TA关注的人

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