自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 atoi

#include#include#includeusing namespace std;#define MAX_INT ((int)0x1fffffff)#define MIN_INT ((int)0x10000000)int atoi(char *str){    int resu=0;    char temp;    int flag=1; 

2017-03-02 16:06:06 297

原创 atoi

includeincludeincludeusing namespace std;define MAX_INT ((int)0x1fffffff)define MIN_INT ((int)0x10000000)int atoi(char *str){ int resu=0; char temp; int flag=1; if(str==NULL) return

2017-03-02 16:00:41 357

原创 leetcode之20. Valid Parentheses

原题: Given a string containing just the characters ‘(‘, ‘)’, ‘{‘, ‘}’, ‘[’ and ‘]’, determine if the input string is valid.The brackets must close in the correct order, “()” and “()[]{}” are all valid

2016-10-10 16:39:37 281

原创 leetcode之7. Reverse Integer(要能存储大数,判断溢出)

原题: Reverse digits of an integer.Example1: x = 123, return 321 Example2: x = -123, return -321 ********************************我是一条分割线***************class Solution {public: int reverse(int x) {

2016-10-10 11:10:30 337

原创 leetcode之169. Majority Element

原题: Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.You may assume that the array is non-empty and the majority element al

2016-10-09 09:19:13 227

转载 大数相乘

大数相乘的几种方法,主要就是模拟列式 http://www.cnblogs.com/heyonggang/p/3599857.html http://www.cnblogs.com/heyonggang/p/3599857.htmlvoid reverseOrder(char* str, int p, int q){ char temp; while(p < q) {

2016-10-09 08:43:27 244

原创

百度百科中写道“最小堆,是一种经过排序的完全二叉树,其中任一非终端节点的数据值均不大于(或不小于)其左孩子和右孩子节点的值。” 但是当尝试用C++写一个堆的时候,首先想到的事定义叶子节点,根节点等,但是,在堆中并不需要定义这些,也就是说,堆的实现与树的实现并没有什么关系,实现堆只需要一个队列即可。在队列中通过下标操作寻找父节点、左孩子和右孩子。 堆只是一种抽象的结构,一种对数据的处理方法,实际上

2016-09-28 15:40:50 290

原创 leetcode之392. Is Subsequence(C++解法 动态规划 贪心 模式匹配)

模式匹配,字符串查找,动态规划

2016-09-21 18:31:00 3107

原创 leetcode之70. Climbing Stairs(C++解法 动态规划思想)

原题: 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?*****************************我是一

2016-09-21 15:19:49 1490

原创 leetcode之83. Remove Duplicates from Sorted List(C++实现 链表去重)

题目: Given a sorted linked list, delete all duplicates such that each element appear only once.For example, Given 1->1->2, return 1->2. Given 1->1->2->3->3, return 1->2->3.***************************

2016-09-14 15:06:20 510

原创 leetcode之349. Intersection of Two Arrays (C++解法 哈希表和vector)

原题: Given two arrays, write a function to compute their intersection.Example: Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2].Note: Each element in the result must be unique. The result can

2016-09-14 14:12:25 283

原创 leetcode之137. Single Number II(C++解法 哈希表计数)

题目: Given an array of integers, every element appears three times except for one. Find that single one.Note: Your algorithm should have a linear runtime complexity. Could you implement it without usi

2016-09-14 11:02:24 380

原创 leetcode之136. Single Number

题目: Given an array of integers, every element appears twice except for one. Find that single one.Note: Your algorithm should have a linear runtime complexity. Could you implement it without using ext

2016-09-14 10:56:09 197

原创 leetcode之92. Reverse Linked List II(C++读错题版本,交换一个链表中指定的两个位置上的元素)

Reverse a linked list from position m to n. Do it in-place and in one-pass.For example: Given 1->2->3->4->5->NULL, m = 2 and n = 4,return 1->4->3->2->5->NULL.Note: Given m, n satisfy the following co

2016-09-13 21:16:29 298

原创 leetcode之328. Odd Even Linked List(C++解法)

题目: Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the value in the nodes.You should try to do it in

2016-09-13 15:14:02 281

原创 leetcode之24. Swap Nodes in Pairs(C++实现&链表实现和整体测试)

题目: Given a linked list, swap every two adjacent nodes and return its head.For example, Given 1->2->3->4, you should return the list as 2->1->4->3.Your algorithm should use only constant space. You m

2016-09-13 11:16:26 339

原创 leetcode之217. Contains Duplicate(C++解法)

原题: Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the array, and it should return false if every elemen

2016-09-11 20:42:45 398

原创 leetcode之389. Find the Difference(C++解法)

原题: Given two strings s and t which consist of only lowercase letters.String t is generated by random shuffling string s and then add one more letter at a random position.Find the letter that was adde

2016-09-11 20:40:56 612

原创 leetcode之11. Container With Most Water(C++解法)

原题: Given n non-negative integers a1, a2, …, an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Find tw

2016-09-11 20:37:04 242

原创 leetcode之26. Remove Duplicates from Sorted Array(C++解法)

题目: Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.Do not allocate extra space for another array, you must do this in place with

2016-09-11 20:26:07 230

原创 leetcode之27. Remove Element(C++解法)

题目: Given an array and a value, remove all instances of that value in place and return the new length.Do not allocate extra space for another array, you must do this in place with constant memory.The

2016-09-11 20:23:30 232

原创 leetcode之104. Maximum Depth of Binary Tree(C++解法)

*****************************我是分割线************************ /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * Tr

2016-09-11 20:22:05 240

原创 leetcode之189. Rotate Array(C++解法)

题目: Rotate an array of n elements to the right by k steps.For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4].Note: Try to come up as many solutions as you can,

2016-09-11 20:20:08 316

原创 leetcode之147. Insertion Sort List(C++解法)

题目: Sort a linked list using insertion sort. 链表的插入排序 ********************************我是分割线***************************** /** * Definition for singly-linked list. * struct ListNode { * int

2016-09-11 20:14:38 410

原创 leetcode之203. Remove Linked List Elements(C++解法)

题目: Remove all elements from a linked list of integers that have value val.Example Given: 1 –> 2 –> 6 –> 3 –> 4 –> 5 –> 6, val = 6 Return: 1 –> 2 –> 3 –> 4 –> 5 ****************************我是分割线***

2016-09-11 20:12:36 292

原创 leetcode之219. Contains Duplicate II(C++解法)

题目: Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] and the difference between i and j is at most k. ****

2016-09-11 20:10:00 341

原创 leetcode之234. Palindrome Linked List(C++解法)

题目: Given a singly linked list, determine if it is a palindrome.Follow up: Could you do it in O(n) time and O(1) space?Subscribe to see which companies asked this question **************************

2016-09-11 20:04:57 315

原创 leetcode之242. Valid Anagram(C++解法)

题目: Given two strings s and t, write a function to determine if t is an anagram of s.For example, s = “anagram”, t = “nagaram”, return true. s = “rat”, t = “car”, return false.Note: You may assume

2016-09-11 20:03:07 426

原创 leetcode之237. Delete Node in a Linked List(C++解法)

题目: Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.Supposed the linked list is 1 -> 2 -> 3 -> 4 and you are given the third node with value

2016-09-11 20:00:08 262

原创 leetcode之242. Valid Anagram(C++解法)

题目 Given two strings s and t, write a function to determine if t is an anagram of s.For example, s = “anagram”, t = “nagaram”, return true. s = “rat”, t = “car”, return false.Note: You may assume t

2016-09-11 19:58:38 315

原创 leetcode之258. Add Digits(C++解法)

题目: Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.For example:Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2. Since 2 has only one dig

2016-09-11 19:57:08 448

原创 leetcode之283. Move Zeroes

题目: Given an array nums, write a function to move all 0’s to the end of it while maintaining the relative order of the non-zero elements.For example, given nums = [0, 1, 0, 3, 12], after calling your

2016-09-11 19:54:44 198

原创 leetcode之371. Sum of Two Integers(C++解法)

题目: Write a function that takes a string as input and returns the string reversed.Example: Given s = “hello”, return “olleh”. *********************我是分割线************************* class Solution { p

2016-09-11 19:36:45 448

原创 leetcode之387. First Unique Character in a String(C++解法)

题目: Given a string, find the first non-repeating character in it and return it’s index. If it doesn’t exist, return -1.Examples:s = “leetcode” return 0.s = “loveleetcode”, return 2. Note: You may a

2016-09-11 19:33:14 277

转载 计算机原理 —— 主板与内存映射

原地址:http://liaoph.com/motherboard-and-memory-map/感兴趣存过来的哈我打算写几篇关于计算机内部原理的文章,来帮助解释现代操作系统内核是如何工作的。我希望这些文章能对那些对这部分内容感兴趣但又没有相关经验的爱好者和程序员们有所帮助。文章主要关注 Linux,Windows 和 Intel 处理器。我对内部原理有强烈的爱好,我曾经写过一些内

2016-05-11 14:36:11 494

原创 Git初探——ubuntu命令行安装git并简单使用

Git初探——ubuntu命令行安装git并简单使用 Linux版本14.04 平台:虚拟机 状态:用户态即可,不推荐使用root 1、 git安装:sudo apt-get install git 2、 在根目录下新建工作空间并初始化 mkdir hello_git cd hello-git 初始化 3、 在当前工作目录下编辑一个简单的c文件 vim hell.c

2016-04-21 17:55:05 3744

原创 基于微信的分布式系统分析

如今微信已经成为很多人生活中不可缺少的一部分,无论是在社交、商业推广还是支付领域,微信都有着杰出的表现。自2011年诞生以来,截止到2015年第一季度,微信已经覆盖中国90%以上的智能手机,月活跃用户达到5.49亿,用户覆盖200多个国家、超过20种语言,使用微信支付的用户已经达到4亿左右。微信提供公众平台、朋友圈、消息推送等功能,用户可以通过“摇一摇”、“搜索号码”、“附近的人”、扫二维码方式添加

2016-04-21 09:45:03 6950

原创 linux ubuntu编写内核模块并添加

linux ubuntu编写内核模块并添加

2016-04-19 20:37:09 3950 1

空空如也

空空如也

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

TA关注的人

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