自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(26)
  • 资源 (1)
  • 收藏
  • 关注

原创 [C++] LeetCode 9. Palindrome Number

题目描述Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.Example 1:Input: 121Output: trueExample 2:Input: -121Output: fals...

2019-01-30 16:00:11 125

原创 [C++] LeetCode 70. Climbing Stairs

题目描述:You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?Note: Given n will be a p...

2019-01-30 15:20:45 128

原创 [LeetCode] 3. Longest Substring Without Repeating Characters (C++)

题目描述Given a string, find the length of the longest substring without repeating characters.Example 1:Input: "abcabcbb"Output: 3 Explanation: The answer is "abc", with the length of 3. Examp...

2019-01-24 14:03:03 139

原创 [LeetCode] 806. Number of Lines To Write String (C++)

We are to write the letters of a given string S, from left to right into lines. Each line has maximum width 100 units, and if writing a letter would cause the width of the line to exceed 100 units, it...

2019-01-18 15:29:40 116

原创 [LeetCode] 693. Binary Number with Alternating Bits (C++)

Given a positive integer, check whether it has alternating bits: namely, if two adjacent bits will always have different values.Example 1:Input: 5Output: TrueExplanation:The binary representat...

2019-01-18 15:29:30 97

原创 [LeetCode] 821. Shortest Distance to a Character (C++)

Given a string S and a character C, return an array of integers representing the shortest distance from the character C in the string.Example 1:Input: S = "loveleetcode", C = 'e'Output: [3, 2, 1...

2019-01-18 15:29:17 110

原创 [LeetCode] 2. Add Two Numbers (C++)

题目描述:You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and r...

2019-01-18 15:29:02 254

原创 [LeetCode] 867. Transpose Matrix (C++)

Given a matrix A, return the transpose of A.The transpose of a matrix is the matrix flipped over it's main diagonal, switching the row and column indices of the matrix. Example 1:Input: [[1,2...

2018-11-01 15:55:45 212

原创 [LeetCode] 559. Maximum Depth of N-ary Tree(C++)

Given a n-ary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.For example, given a 3-ary tree: ...

2018-10-31 15:29:27 232

原创 [LeetCode] 905. Sort Array By Parity(C++)

Given an array A of non-negative integers, return an array consisting of all the even elements of A, followed by all the odd elements of A.You may return any answer array that satisfies this conditi...

2018-10-31 14:25:38 108

原创 [LeetCode] 922. Sort Array By Parity II(C++)

Given an array A of non-negative integers, half of the integers in A are odd, and half of the integers are even.Sort the array so that whenever A[i] is odd, i is odd; and whenever A[i] is even, i is...

2018-10-31 14:25:28 128

原创 [LeetCode] 709. To Lower Case(C++)

Implement function ToLowerCase() that has a string parameter str, and returns the same string in lowercase. Example 1:Input: "Hello"Output: "hello"Example 2:Input: "here"Output: "here"...

2018-10-31 14:25:19 614

原创 [LeetCode] 654. Maximun Binary Tree(C++)

Given an integer array with no duplicates. A maximum tree building on this array is defined as follow:The root is the maximum number in the array. The left subtree is the maximum tree constructed f...

2018-10-23 17:42:04 147

原创 LeetCode 921

Given a string S of '(' and ')' parentheses, we add the minimum number of parentheses ( '(' or ')', and in any positions ) so that the resulting parentheses string is valid.Formally, a parentheses s...

2018-10-22 20:52:30 161

原创 [LeetCode] 807. Max increase to keep city skyline(C++)

In a 2 dimensional array grid, each value grid[i][j] represents the height of a building located there. We are allowed to increase the height of any number of buildings, by any amount (the amounts can...

2018-10-22 17:07:37 122

原创 单例模式及其析构

#include <cstddef>class Single {public:    ~Single() {}    static Single* instance() {        if (ptr == NULL) {            ptr = new Single;        }        return ptr;    }    voi...

2018-10-12 20:59:12 3639

原创 VMWare 下Ubuntu虚拟机磁盘扩容

开发到后期,发现虚拟机磁盘空间不够,只有想办法来扩容啦~1、在VM软件中扩展虚拟机硬盘容量   原始的磁盘大小为320G,为做演示,增加到330G,点击扩展后,VM中的磁盘大小就设置好了。2、在Ubuntu系统中扩展磁盘为了便于管理,我将新扩容的磁盘大小设置为一个分区来专门放一个项目,这样的话,不同的磁盘分区放不同的项目就一目了然了。因此在本部分要做的有两件...

2018-09-27 18:06:58 606

原创 leveldb源码-----数据结构之Arena

leveldb中的内存管理主要是通过Arena。Arena管理内存的思想是用一个vector来管理申请的block// Array of new[] allocated memory blocksstd::vector<char*> blocks_;每个block的大小为4096Byte。用char*类型的alloc_ptr_指向block中可用的剩余内存的首地址,si...

2018-08-19 22:00:35 303

原创 Android HIDL学习

2018-04-20 20:03:44 549

原创 Linux下编写Who命令

Who命令可以显示登录系统的用户信息。1、查看who命令相关内容通过联机手册,可以查询到who命令的详解。在终端输入man who,在Ubuntu 14.04 系统上,在DESCRIPTION可以看到如下所示的内容。即登录的信息是放在/var/run/utmp 、/var/log/wtmp中,运行who命令后,从utmp文件中读取信息。因此,我们继续查看utmp文件是什么。2、查看utmp运用ma...

2018-03-07 11:37:34 2746

原创 Ubuntu下安装CodeBlocks

我是用的Ubuntu LTS版本,VM虚拟机1、首先访问“https://launchpad.net/~damien-moore/+archive/ubuntu/codeblocks-stable”,寻找一段黑色加粗的字,即为版本,比如我的是ppa:damien-moore/codeblocks-stable 在终端输入sudo add-apt-repository ppa:damien-moor...

2018-03-01 15:06:42 437

原创 [LeetCode] 292. Nim Game

You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 stones. The one who removes the last stone will be the

2016-08-22 19:12:30 138

原创 代理模式C++实现

#include #include class Method //公共接口{public: void virtual giveDolls(){ return; } void virtual giveFlowers() { return; }protected:private:};class Boy : public M

2016-08-03 19:21:52 172

原创 装饰模式C++实现

#include #include class Person{public: Person() = default; virtual void showDecorator() { return; }};class Man : public Person{public: Man() = default; Man(std::string str) : Name(str){

2016-07-27 15:49:01 237

原创 策略模式模式C++实现

策略模式:当用户需要选择不同的算法或行为时,如果把这些算法或行为写在一个类里,通过判断来选择的话,这个类将变得非常复杂并且难以维护。策略模式就是构造一个抽象类,具体的算法或者行为继承这个类,让用户来选择。这样做的好处是,可以随时增加或者修改行为,即增加、修改算法或行为的类就可以了。策略模式和简单工厂模式的差别:简单工厂模式是通过一个抽象类来构造新对象,用户接触不到具体对象。策略模式

2016-07-26 20:50:49 427

原创 简单工厂模式C++实现

面向对象的优点:1、可维护:修改简单2、可复用:可以在多个模块重复使用3、可扩展:可以方便地加入一些其他功能4、灵活性好:可以适应不同的需求简单工厂模式:对程序进行功能分析,不同功能模块独立

2016-07-25 17:24:46 364

sourceinsight4.0安装及破解包

sourceinsight安装包及其破解包,亲测可用。。摘要必须大于50个字节!

2018-05-22

空空如也

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

TA关注的人

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