自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

wangxiaobupt的专栏

书写是为了更好的思考

  • 博客(19)
  • 资源 (2)
  • 收藏
  • 关注

原创 LeetCode 168 Excel Sheet Column Title

题目 题解 class Solution { public: string convertToTitle(int n) { return (n>26 ? convertToTitle((n-1)/26) : "") + (char)((n-1) % 26 + 'A'); } };

2015-06-24 16:32:19 592

原创 LeetCode 7 Reverse Integer

题目 题解 class Solution { public: int reverse(int x) { long result = 0; while(x != 0) { result = result*10 + x % 10; x /=

2015-06-24 15:32:35 502

原创 LeetCode 101 Symmetric Tree

题目 题解 非递归 /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) :

2015-06-23 21:03:12 489

原创 LeetCode 219 Contains Duplicate II

题目 分析 用map存储,查找即可。 题解 class Solution { public: bool containsNearbyDuplicate(vector& nums, int k) { map mymap; for(int i=0;i<nums.size();

2015-06-23 16:09:11 514

原创 LeetCode 112 Path Sum

题目 题解 /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : v

2015-06-21 23:08:36 539

原创 LeetCode 110 Balanced Binary Tree

题目 题解 非递归 /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(i

2015-06-21 10:45:57 527

原创 LeetCode 217 Contains Duplicate

题目 分析 用map遍历一遍判断有无重复即可。 题解 class Solution { public: bool containsDuplicate(vector& nums) { int SIZE = nums.size(); if(SIZE =

2015-06-19 15:41:51 514

原创 LeetCode 129 Sum Root to Leaf Numbers

题目 题解 /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : v

2015-06-16 22:47:03 547

原创 LeetCode 111 Minimum Depth of Binary Tree

题目 分析 递归可求出最小深度,要考虑左子树或右子树为空的情景。 题解 /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * Tre

2015-06-16 19:54:48 537

原创 LeetCode 116 Populating Next Right Pointers in Each Node

题目 分析 可以通过层序遍历,将一层的节点放入容器中,前一个节点指向后一个,最后一个节点指向NULL。 题解 /** * Definition for binary tree with next pointer. * struct TreeLinkNode { *

2015-06-15 21:05:20 584

原创 Mac创建无线热点

步骤如下: 1.系统偏好设置  ->  共享 2.共享互联网 3.端口选择 WIFI 4.WIFI设置为个人型,并设置密码 5.勾选WIFI选项框之后启动共享互联网即可。

2015-06-14 23:40:59 913

原创 LeetCode 107 Binary Tree Level Order Traversal II

题目 分析 同题102  Leetcode 102 层序遍历到底 只是vector插入的顺序不同 题解 /** * Definition for a binary tree node. * struct TreeNode { * int v

2015-06-13 14:35:25 603

原创 LeetCode 145 Binary Tree Postorder Traversal

题目 递归分析 如果用递归的方法则要解决这么两个问题: 1.如果 f(root)可以得到整个树的后序遍历,那么f(root-left)就能得到左子树的后序,那么也可以得到右子树的后序 左子树的后序  +  右子树的后序 + 根结点即可得到结果。 2. 不可能一直向下递归下去,终止条件:当遍历到

2015-06-13 14:26:54 576

原创 LeetCode 102 Binary Tree Level Order Traversal

题目 题解 /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : v

2015-06-13 13:06:30 538

原创 LeetCode 226 Invert Binary Tree

题目 分析 用递归很容易解决。 题解 /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode

2015-06-12 19:18:16 952

原创 Python定制类

定制类 打印类信息 class Person(object): def __init__(self, name, gender): self.name = name self.gender = gender class Student(Person): def __init__(self, name, gender,

2015-06-07 14:25:15 807

原创 Python类与继承

类与继承 继承一个类 class Person(object): def __init__(self, name, gender): self.name = name self.gender = gender class Teacher(Person): def __init__(self, name, gender, cou

2015-06-07 11:31:23 856

原创 Python面向对象编程基础

面向对象编程基础 定义类并创建实例 class Person(object): pass xiaoming = Person() xiaohong = Person() print xiaoming print xiaohong print xiaoming == xiaohong 创建实例属性 class Person(object):

2015-06-07 10:09:05 783

原创 Python函数式编程实践

Python支持的函数式编程: 1.支持高阶函数 2.支持闭包 3.有限度的支持匿名函数 高阶函数 变量可以指向函数: >>> abs(-10) 10 >>> f = abs >>> f(-10) 10 >>> 函数名是指向函数的变量 >>> abs = len >>> abs([1,2,3,4]) 4 >>>

2015-06-05 23:00:06 753

空空如也

空空如也

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

TA关注的人

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