- 博客(124)
- 收藏
- 关注
转载 epoll详解
原文地址:http://blog.csdn.net/xiajun07061225/article/details/9250579什么是epollepoll是什么?按照man手册的说法:是为处理大批量句柄而作了改进的poll。当然,这不是2.6内核才有的,它是在2.5.44内核中被引进的(epoll(4) is a new API introduced in Linux ke
2015-10-12 09:41:59 241
转载 C++中空类和空结构体大小(sizeof)详谈(转)
原文地址:http://blog.sina.com.cn/s/blog_9f14969901012u20.html原文 : http://blog.csdn.net/shijun_zhang/article/details/7660719 先看一下测试代码,结果在G++ 4.5 64bit机器上打印出来。 [cpp] view plaincopy
2015-09-30 14:59:16 578
转载 [LeetCode 105] Construct Binary Tree from Preorder and Inorder Traversal
原文地址:http://blog.csdn.net/benbenab/article/details/8139440Given preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tr
2015-09-23 21:29:55 236
转载 [LeetCode 108] Convert Sorted Array to Binary Search Tree
原文地址:http://blog.csdn.net/magisu/article/details/15025037Given an array where elements are sorted in ascending order, convert it to a height balanced BST./** * Definition for a binary tree node.
2015-09-22 19:28:45 223
原创 [LeetCode 199] Binary Tree Right Side View
Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom.For example:Given the following binary tree, 1
2015-09-22 18:44:14 221
转载 [LeetCode 236] Lowest Common Ancestor of a Binary Tree
原文地址:http://www.cnblogs.com/easonliu/p/4643873.htmlGiven a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.According to the definition of LCA on Wikipedia: “T
2015-09-22 18:06:09 227
原创 [LeetCode 94] Binary Tree Inorder Traversal
Given a binary tree, return the inorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [1,3,2].Note: Recursive solutio
2015-09-22 11:12:32 207
原创 [LeetCode 144] Binary Tree Preorder Traversal
Given a binary tree, return the preorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [1,2,3].Note: Recursive soluti
2015-09-22 10:08:46 214
原创 [LeetCode 75] Sort Colors
Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue.Here, we will use the integers
2015-09-07 10:17:55 208
转载 [LeetCode 91] Decode Ways
原文地址:http://blog.csdn.net/lanxu_yy/article/details/17306167题目:A message containing letters from A-Z is being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 2
2015-09-01 22:46:15 159
原创 [LeetCode 151] Reverse Words in a String
Given an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the".Update (2015-02-12):For C programmers: Try to solve it in-place in
2015-09-01 11:21:28 186
原创 [LeetCode 17] Letter Combinations of a Phone Number
Given a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephone buttons) is given below.Input:Digit st
2015-08-28 11:38:55 223
转载 [LeetCode 22] Generate Parentheses
原文地址:http://www.cnblogs.com/codingmylife/archive/2012/09/09/2677428.html还有:http://blog.csdn.net/yutianzuijin/article/details/13161721Given n pairs of parentheses, write a function to generate
2015-08-28 09:23:14 579
原创 [LeetCode 17]
Given a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephone buttons) is given below.Input:Digit st
2015-08-27 17:58:03 83
转载 [LeetCode 49] Group Anagrams
原文地址:http://blog.csdn.net/kangrydotnet/article/details/47777545Given an array of strings, group anagrams together.For example, given: ["eat", "tea", "tan", "ate", "nat", "bat"], Return:[
2015-08-27 16:37:17 280
转载 [LeetCode 3] Longest Substring Without Repeating Characters
原文地址:http://www.cnblogs.com/dollarzhaole/p/3155712.htmlGiven a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating l
2015-08-27 14:38:47 239
转载 [LeetCode 93] Restore IP Addresses
原文地址:http://www.tuicool.com/articles/MBBvuu这里还有一篇:http://blog.csdn.net/doc_sgl/article/details/12351489Given a string containing only digits, restore it by returning all possible valid IP addr
2015-08-27 11:16:56 258
原创 Multiply Strings
class Solution {public: string multiply(string num1, string num2) { int c; int len1=num1.size(); int len2=num2.size(); int i,j,k; vector > r; strin
2015-08-26 22:54:47 65
原创 [LeetCode 71] Simplify Path
Given an absolute path for a file (Unix-style), simplify it.For example,path = "/home/", => "/home"path = "/a/./b/../../c/", => "/c"click to show corner cases.Corner Cases:Did
2015-08-26 14:09:37 193
原创 [LeetCode 5] Longest Palindromic Substring
Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest palindromic substring.我:应该是最简单最无脑的做法了。
2015-08-25 16:15:54 196
转载 [LeetCode 201] Bitwise AND of Numbers Range
原文地址:http://www.cnblogs.com/aboutblank/p/4442193.htmlGiven a range [m, n] where 0 For example, given the range [5, 7], you should return 4.class Solution {public: int rangeBitwiseAnd(
2015-08-22 22:08:05 231
转载 [LeetCode 78] Subsets
原文地址:http://www.cnblogs.com/felixfang/p/3775712.htmlGiven a set of distinct integers, nums, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solu
2015-08-21 14:53:28 163
原创 [LeetCode 260] Single Number III
Given an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements that appear only once.For example:Given
2015-08-21 10:48:16 224
转载 [LeetCode 137] Single Number II
原文地址:http://blog.csdn.net/jiadebin890724/article/details/23306837Given an array of integers, every element appears three times except for one. Find that single one.Note:Your algorithm sh
2015-08-21 10:09:26 261
转载 [LeetCode 136] Single Number
原文地址:http://blog.csdn.net/magisu/article/details/13169283Given an array of integers, every element appears twice except for one. Find that single one.Note:Your algorithm should have a linear
2015-08-20 17:32:28 190
转载 [LeetCode 131] Palindrome Partitioning
原文地址:http://blog.csdn.net/zhanghaodx082/article/details/24184195题目大意:Given a string s, partition s such that every substring of the partition is a palindrome.Return all possible palindrome p
2015-08-20 15:25:28 195
转载 [LeetCode 227] Basic Calculator II
原文地址:http://blog.csdn.net/brucehb/article/details/46593913我:1、当循环中嵌套循环时,要十分注意变量i的值变化。转载的这篇文章中,将i的值完全交由程序中去增减。2、当判断条件中有长度越界和其他的判断时,要将长度判断放在前边。3、找个时间研究一下表达式求值。Implement a basic calculato
2015-08-20 11:12:16 222
原创 [LeetCode 2] Add Two Numbers
You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a link
2015-08-18 17:52:06 225
转载 [LeetCode 229] Majority Element II
原文地址:http://www.cnblogs.com/ZhangYushuang/p/4627503.htmlGiven an integer array of size n, find all elements that appear more than ⌊ n/3 ⌋ times. The algorithm should run in linear time and in O(
2015-08-18 16:55:49 177
转载 [LeetCode 230] Kth Smallest Element in a BST
原文地址:http://blog.csdn.net/brucehb/article/details/46734301iven a binary search tree, write a function kthSmallest to find the kth smallest element in it.Note: You may assume k is always vali
2015-08-18 16:09:21 163
转载 [LeetCode 187] Repeated DNA Sequences
原文地址:http://www.cnblogs.com/grandyang/p/4284205.htmlAll DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACGAATTCCG". When studying DNA, it is sometimes usef
2015-08-18 15:48:41 210
转载 [LeetCode 179] Largest Number
原文地址:http://www.w2bc.com/Article/19411Given a list of non negative integers, arrange them such that they form the largest number.For example, given [3, 30, 34, 5, 9], the largest formed number
2015-08-18 14:49:20 205
转载 [LeetCode 122] Best Time to Buy and Sell Stock II
Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete as many transactions as you like (ie, buy on
2015-08-18 09:38:47 177
转载 [LeetCode 121] Best Time to Buy and Sell Stock
原文地址:http://blog.csdn.net/xshalk/article/details/8150465Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to complete at most on
2015-08-17 14:19:28 182
转载 Matlab中的括号()[]{}
原文地址:http://blog.sina.com.cn/s/blog_618af1950100lbc3.htmlMatlab中经常会用到括号去引用某Array或者是cell的内容,但三者有什么具体区别呢?[ ] 中括号用来构建向量(Vectors)或者是矩阵(Matrices)。如[6.9 9.64 sqrt(-1)] 就是一个有三个元素的向量。[11 12 13; 21 22
2015-08-15 10:36:43 233
转载 Kalman滤波器从原理到实现
原文地址:http://blog.csdn.net/xiahouzuoxin/article/details/39582483转载请注明出处:http://xiahouzuoxin.github.io/notesKalman滤波器的历史渊源We are like dwarfs on the shoulders of giants, by whose grace we
2015-08-14 09:19:53 171
转载 [LeetCode 221] Maximal Square (好好思考下)
原文地址:http://blog.csdn.net/brucehb/article/details/46384411Given a 2D binary matrix filled with 0's and 1's, find the largest square containing all 1's and return its area.For example, given th
2015-08-13 17:22:05 172
转载 [LeetCode 222] Count Complete Tree Nodes
原文地址:http://blog.csdn.net/brucehb/article/details/46448503Given a complete binary tree, count the number of nodes.Definition of a complete binary tree from Wikipedia:In a complete binary t
2015-08-12 19:13:53 166
原创 [LeetCode 240] Search a 2D Matrix II
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sorted in ascending from left to right.Integers in
2015-08-12 17:42:19 186
转载 [LeetCode 74] Search a 2D Matrix
原文地址:http://blog.csdn.net/lanxu_yy/article/details/17261035题目:Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Inte
2015-08-12 16:43:23 174
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人