自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Lightmare625

找工作中。。。

  • 博客(163)
  • 收藏
  • 关注

原创 博客迁移说明!!!

本博客已迁移至 lightmare.cn ,本博客不再更新 , 感谢关注!!

2019-03-21 23:23:26 510

原创 LeetCode172. Factorial Trailing Zeroes

Given an integer n, return the number of trailing zeroes in n!.Example 1:Input: 3Output: 0Explanation: 3! = 6, no trailing zero.Example 2:Input: 5Output: 1Explanation: 5! = 120, one trailing ...

2019-03-15 19:53:14 292

原创 LeetCode53. Maximum Subarray(剑指offer42题)

Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum.Example:Input: [-2,1,-3,4,-1,2,1,-5,4],Output: 6Explanation:...

2019-03-15 11:51:18 305

原创 LeetCode295. Find Median from Data Stream(剑指offer41题)

Median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value. So the median is the mean of the two middle value.For example,[2,3,4], the median is...

2019-03-15 00:36:55 164

原创 LeetCode215. Kth Largest Element in an Array

Kth Largest Element in an ArrayFind the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.Example 1:Input: [3,2,1,5...

2019-03-12 16:20:03 437

原创 第40题:最小的K个数

题目描述输入n个整数,找出其中最小的K个数。例如输入4,5,1,6,2,7,3,8这8个数字,则最小的4个数字是1,2,3,4,。法1,std::sort。快排Onlognclass Solution {public: vector<int> GetLeastNumbers_Solution(vector<int&a

2019-03-10 18:54:15 121

原创 [c++11]range-for中的observing、modifying、proxy iterators

range-for[c++11]What is the correct way of using C++11’s range-based for?What syntax should be used? for (auto elem : container), or for (auto& elem : container) or for (const auto& elem : ...

2019-03-10 16:56:05 329

原创 第39题:数组中超过一半的数字Leetcode:169. Majority Element

题目描述数组中有一个数字出现的次数超过数组长度的一半,请找出这个数字。例如输入一个长度为9的数组{1,2,3,2,2,2,5,4,2}。由于数字2在数组中出现了5次,超过数组长度的一半,因此输出2。如果不存在则输出0。法一。快排std::sort.从小到大的数组。O(nlogn).找到有序数组的中位数。计算他的个数。如果大于数组长度的一半就是要找的数字,否则返回0#inclu...

2019-03-07 23:52:56 651

原创 算法整理:排序

ref:https://www.cnblogs.com/gaochundong/p/comparison_sorting_algorithms.html

2019-03-05 21:28:09 130

原创 图解HTTP-3.

编码提升传输速率HTTP 在传输数据时可以按照数据原貌直接传输, 但也可以在传输过程中通过编码提升传输速率。 通过在传输时编码, 能有效地处理大量的访问请求。 但是, 编码的操作需要计算机来完成, 因此会消耗更多的 CPU 等资源。...

2019-03-03 22:26:09 250

原创 LeetCode51. N-Queens(剑指offer38-3)

Then-queens puzzle is the problem of placingnqueens on ann×nchessboard such that no two queens attack each other.Given an integern, return all distinct solutions to then-queens puzzle.Eac...

2019-03-03 13:30:44 146

原创 图解HTTP-2.简单的 HTTP 协议

目录1. HTTP 协议用于客户端和服务器端之间的通信1.1 请求报文1.2 响应报文1.3HTTP 是不保存状态的协议--引入 Cookie1.4HTTP 协议使用 URI 让客户端定位到资源2.HTTP/1.1中的方法GET :获取资源POST: 传输实体主体PUT: 传输文件HEAD: 获得报文首部DELETE: 删除文件OPTIONS: ...

2019-03-03 00:02:37 380

原创 LeetCode77. Combinations(剑指offer38-2)

Given two integersnandk, return all possible combinations ofknumbers out of 1 ...n.Example:Input:n = 4, k = 2Output:[ [2,4], [3,4], [2,3], [1,2], [1,3], [1,4],]回溯法。细节。循环...

2019-03-02 20:21:25 116

原创 LeetCode47.Permutations II(剑指offer38-1)

Given a collection of numbers that might contain duplicates, return all possible unique permutations.Example:Input: [1,1,2]Output:[ [1,1,2], [1,2,1], [2,1,1]]法1.递归。swap.回溯。唯一要多做的就是去重。用...

2019-03-02 18:00:21 652

原创 LeetCode46. Permutations

Given a collection ofdistinctintegers, return all possible permutations.Example:Input: [1,2,3]Output:[ [1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], [3,2,1]]法1.回溯法。递归。每次交换num中的两...

2019-03-01 23:04:14 123

原创 LeetCode567. Permutation in String

Given two stringss1ands2, write a function to return true ifs2contains the permutation ofs1. In other words, one of the first string's permutations is thesubstringof the second string.Exampl...

2019-03-01 23:04:04 80

原创 图解HTTP-1.web和网络基础

目录1.3 项 WWW 构建技术2. TCP/IP 是互联网相关的各类协议族的总称协议(protocol)TCP/IP分层管理TCP/IP通信传输流封装(encapsulate)3. 与 HTTP 关系密切的协议 : IP、 TCP 和DNS3.1负责传输的IP协议(网络层)路由选择(routing)3.2确保可靠性的 TCP 协议(传输层)字节流服...

2019-02-28 22:50:15 211

原创 LeetCode426.Convert Binary Search Tree to Sorted Doubly Linked List

题目Convert a BST to a sorted circular doubly-linked list in-place. Think of the left and right pointers as synonymous to the previous and next pointers in a doubly-linked list.Let's take the foll...

2019-02-28 14:26:51 252

原创 LeetCode701.Insert into a Binary Search Tree

题目给定二叉搜索树(BST)的根节点和要插入树中的值,将值插入二叉搜索树。 返回插入后二叉搜索树的根节点。 保证原始二叉搜索树中不存在新值。注意,可能存在多种有效的插入方式,只要树在插入后仍保持为二叉搜索树即可。 你可以返回任意有效的结果。例如,给定二叉搜索树: 4 / \ 2 7 / \ 1 3和 ...

2019-02-28 10:28:40 91

原创 LeetCode700. Search in a Binary Search Tree

题目给定二叉搜索树(BST)的根节点和一个值。 你需要在BST中找到节点值等于给定值的节点。 返回以该节点为根的子树。 如果节点不存在,则返回 NULL。例如,给定二叉搜索树: 4 / \ 2 7 / \ 1 3和值: 2你应该返回如下子树: 2 / \ ...

2019-02-28 08:55:02 78

原创 LeetCode106. Construct Binary Tree from Inorder and Postorder Traversal

题目 根据一棵树的中序遍历与后序遍历构造二叉树。注意:你可以假设树中没有重复的元素。例如,给出中序遍历 inorder = [9,3,15,20,7]后序遍历 postorder = [9,15,7,20,3]返回如下的二叉树: 3 / \ 9 20 / \ 15 7Tagdfs . post+inorder .递归...

2019-02-27 15:55:52 80

原创 C++声明

目录1.const1.1 const obj 如果调用 non-const member fun会编译出错经典错误1.2 例子:STD里的操作符重载1.3 例子:《cpp primer》15节 -基类的定义1.constclass complex{public: complex (double r = 0, double i = 0): re (r), im ...

2019-02-26 20:28:28 1588

原创 C++ OOP

目录1.概述2.继承2.0 基类2.1 派生类2.2 空基类优化(本节不理解2.3 虚基类2.4 继承方式2.5 成员名称查找(不理解)2.6 C++11新增overridefinal3. 动态绑定3.1 对象模型:虚表和虚指针3.2 动态绑定的三个条件3.3 static type和dynamic type区别3.4 关于this...

2019-02-25 16:28:30 399

原创 LeetCode105. Construct Binary Tree from Preorder and Inorder Traversal

题目 根据一棵树的前序遍历与中序遍历构造二叉树。注意:你可以假设树中没有重复的元素。例如,给出前序遍历 preorder = [3,9,20,15,7]中序遍历 inorder = [9,3,15,20,7]返回如下的二叉树: 3 / \ 9 20 / \ 15 7Tag二分查找。dfs.递归。 代码0x00...

2019-02-25 01:15:16 91

原创 LeetCode297. Serialize and Deserialize Binary Tree

题目 序列化是将一个数据结构或者对象转换为连续的比特位的操作,进而可以将转换后的数据存储在一个文件或者内存中,同时也可以通过网络传输到另一个计算机环境,采取相反方式重构得到原数据。请设计一个算法来实现二叉树的序列化与反序列化。这里不限定你的序列 / 反序列化算法执行逻辑,你只需要保证一个二叉树可以被序列化为一个字符串并且将这个字符串反序列化为原始的树结构。示例: 你可以将以下二...

2019-02-24 20:06:28 98

原创 LeetCode997. Find the Town Judge

题目 在一个小镇里,按从 1 到 N 标记了 N 个人。传言称,这些人中有一个是小镇上的秘密法官。如果小镇的法官真的存在,那么:小镇的法官不相信任何人。 每个人(除了小镇法官外)都信任小镇的法官。 只有一个人同时满足属性 1 和属性 2 。给定数组 trust,该数组由信任对 trust[i] = [a, b] 组成,表示标记为 a 的人信任标记为 b 的人。如果小镇存在秘...

2019-02-24 18:04:30 259

原创 c++标准之IO库

1.面向对象的标准库2.多种IO标准库工具istream,提供输入操作 ostream,提供输出操作 cin:读入标准输入的istream对象.全局对象externstd::istreamcin;定义于头文件<iostream> cout:写到标准输出的ostream对象 cerr:输出标准错误的ostream对象。常用语程序错误信息 >&gt...

2019-02-24 10:29:32 364

原创 LeetCode1. Two Sum

题目 给定一个整数数组 nums 和一个目标值 target,请你在该数组中找出和为目标值的那 两个 整数,并返回他们的数组下标。你可以假设每种输入只会对应一个答案。但是,你不能重复利用这个数组中同样的元素。示例:给定 nums = [2, 7, 11, 15], target = 9因为 nums[0] + nums[1] = 2 + 7 = 9所以返回 [0, 1]...

2019-02-22 23:34:43 79

原创 《程序员必读的职业规划书》读书笔记

你该去什么样的公司、做什么样的事情、拿多少钱,都取决于⼀个问题:你想成为⼀个什么样的⼈。⼯作只是⼈⽣的⼀部分,是⽤来⽀撑你⼈⽣价值的核⼼框架之⼀。在你⾃⼰没有想明⽩的时候,没有⼈能帮你。第⼀,给⾃⼰定义⼀年期的目标。⼈⽣的意义都是我们赋予它的。⼈⽣有时候就像⼀个没有终点的旅程,有⼈的意义是⾏程的边界,有⼈的意义是沿途的美景,有⼈的意义同⾏的伴侣。当你定下⼀个目标,⼈⽣就变的有了意义。第⼆...

2019-02-22 14:29:46 333

原创 TCP/IP简介

ref五分钟读懂TCP 协议——TCP协议简介TCP/IP协议(一)网络基础知识

2019-02-22 12:56:48 98

原创 LeetCode145. Binary Tree Postorder Traversal

题目 给定一个二叉树,返回它的 后序 遍历。示例:输入: [1,null,2,3] 1 \ 2 / 3 输出: [3,2,1]进阶: 递归算法很简单,你可以通过迭代算法完成吗?考点思路代码1.递归//递归:左-右-根class Solution {public: vector<int&...

2019-02-22 01:15:35 94

原创 LeetCode144. Binary Tree Preorder Traversal

题目 给定一个二叉树,返回它的 前序 遍历。 示例:输入: [1,null,2,3] 1 \ 2 / 3 输出: [1,2,3]进阶: 递归算法很简单,你可以通过迭代算法完成吗?考点思路见LeetCode94. Binary Tree Inorder Traversal代码1.递归class Solut...

2019-02-22 00:40:05 72

原创 LeetCode94. Binary Tree Inorder Traversal

题目 给定一个二叉树,返回它的中序 遍历。示例:输入: [1,null,2,3] 1 \ 2 / 3输出: [1,3,2]进阶: 递归算法很简单,你可以通过迭代算法完成吗?考点stack递归中序遍历:左-根-右思路ref:二叉树的前中后和层序遍历详细图解(递归和非递归写法)1.递归若根节点为空,返回。左...

2019-02-22 00:08:08 113

原创 vscode + leetcode +github 同步

1.用VScode打开本地leetcode文件夹C:\Users\Administrator\.leetcode2.上传到本地git库3.打开github桌面,上传到远程库

2019-02-21 19:10:00 2294

原创 vs code配置c/c++调试环境+mingw+windows

目录 1.安装codeblocks2.配置mingw环境变量3.配置.vscode文件夹的json文件ref1.安装codeblocks我已经安装过vscode和c++扩展插件,现在需要g++编译器,安装mingw操作复杂,直接安装codeblocks,自带mingw安装。codeblocks-17.12mingw-setup.exe链接:https://pa...

2019-02-21 18:24:05 946

原创 LeetCode104.Maximum Depth of Binary Tree

题目 给定一个二叉树,找出其最大深度。二叉树的深度为根节点到最远叶子节点的最长路径上的节点数。说明: 叶子节点是指没有子节点的节点。示例:给定二叉树 [3,9,20,null,null,15,7], 3 / \ 9 20 / \ 15 7返回它的最大深度 3 。考点dfs 递归思路代码/** * Defi...

2019-02-21 13:32:31 96

原创 LeetCode111. Minimum Depth of Binary Tree

题目 给定一个二叉树,找出其最小深度。最小深度是从根节点到最近叶子节点的最短路径上的节点数量。说明: 叶子节点是指没有子节点的节点。示例:给定二叉树 [3,9,20,null,null,15,7], 3 / \ 9 20 / \ 15 7返回它的最小深度  2.考点dfs.递归思路代码1.递归/*...

2019-02-21 13:27:22 77

原创 Leetcode463. Island Perimeter

题目 给定一个包含 0 和 1 的二维网格地图,其中 1 表示陆地 0 表示水域。网格中的格子水平和垂直方向相连(对角线方向不相连)。整个网格被水完全包围,但其中恰好有一个岛屿(或者说,一个或多个表示陆地的格子相连组成的岛屿)。岛屿中没有“湖”(“湖” 指水域在岛屿内部且不和岛屿周围的水相连)。格子是边长为 1 的正方形。网格为长方形,且宽度和高度均不超过 100 。计算这个岛屿的周长...

2019-02-19 23:10:18 81

原创 LeetCode706. Design HashMap

题目 不使用任何内建的哈希表库设计一个哈希映射具体地说,你的设计应该包含以下的功能put(key, value):向哈希映射中插入(键,值)的数值对。如果键对应的值已经存在,更新这个值。 get(key):返回给定的键所对应的值,如果映射中不包含这个键,返回-1。 remove(key):如果映射中存在这个键,删除这个数值对。示例:MyHashMap hashMap = n...

2019-02-19 01:07:07 88

原创 LeetCode705. Design HashSet

题目 不使用任何内建的哈希表库设计一个哈希集合具体地说,你的设计应该包含以下的功能add(value):向哈希集合中插入一个值。 contains(value) :返回哈希集合中是否存在这个值。 remove(value):将给定值从哈希集合中删除。如果哈希集合中没有这个值,什么也不做。示例:MyHashSet hashSet = new MyHashSet();hash...

2019-02-19 00:31:07 188

空空如也

空空如也

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

TA关注的人

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