自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

转载 程序员的八种级别

你有没有遇到过那个经典的面试问题,“你预见过自己5年后的职位吗?”。每当有人这样问时,我就会想到Twisted Sister乐队从1984年开始发行的某张专辑。当然是玩摇滚,至不济也得是个摇滚明星级别的程序员吧。这种问题通常得不到正面回答——就像那种在面试中无病呻吟式的陈词滥调,”你最大的缺点是什么?”。有的时候是不是太大起大落?以至于那些无辜的旁观者会受到伤害。但是,我认为这是一

2016-03-24 14:41:21 487

转载 程序员的四种类型

不是每一个写代码的都是程序员。这里,我把程序员定义为以编程为生的人。我认为世界上存在四类程序员:(计算机)科学家、码农、专家和工匠。下面我一一介绍自己的观点。 (计算机)科学家与其说他们是程序员,不如说他们是数学家。他们发明了各种理论、算法和术语,教科书上那冗长的证明和计算也出自他们之手,其他的程序员都或多或少受益于他们的成果。有时,他们的一篇论文能改变整个业界的思维方式,

2016-03-24 14:10:08 1006

转载 高效率编辑器 VIM-操作篇

插入操作“i” — 从光标所在位置前开始“I” –光标移到当前行的行首,然后在其前插入文本“a”– 光标当前所在位置之后追加新文本“A” –命令将把光标挪到所在行的行尾“o” — 在当前行的下面插入新行“O” — 在当前行的上面插入新行移动操作按字移动光标在vim中,”字”有两种含义:a. 广义的字,它可以是两个空

2015-11-21 13:52:05 339

转载 mac/linux终端光标的快捷键操作

摘自网络:原标题是类似linux/unix命令行终端的光标及字符控制快捷键的东东常用的快捷键:Ctrl + d        删除一个字符,相当于通常的Delete键(命令行若无所有字符,则相当于exit;处理多行标准输入时也表示eof)Ctrl + h        退格删除一个字符,相当于通常的Backspace键Ctrl + u        删除光标之前到行首的字符

2015-11-21 09:31:11 342

转载 Why BIOS loads MBR into 0x7C00 in x86 ?

原文链接:点击打开链接The mysteries arround "0x7C00" in x86 architecture bios bootloaderDo you know "0x7C00", a magic number, in x86 assembler programming ? "0x7C00" is the memory address which BIO

2015-11-14 10:06:26 322

转载 动态链接库中函数的地址确定---PLT和GOT

前面写过动态链接库 延迟绑定的一篇博文,那篇文章我非常喜欢,但是当时刚搞清楚,自己写的比较凌乱,我最近学习了Ulrich Drepper的How to write share library,学习了几篇其他的讲述动态链接的文章,再次整理了这篇文章。    有一个问题是我们调用了动态链接库里面的函数,我们怎么知道动态链接库里面的函数的地址呢?事实上,直到我们第一次调用这个函数,我

2015-10-13 16:55:07 3039

转载 Mac OS X 10.10 装gdb

homebrew地址:https://github.com/Homebrew/homebrew-dupes要安装有homebrew,homebrew 是一个包管理器。安装gdb 的命令如下,安装完之后需要对gdb 进行签名,签名方式转载自:http://plotcup.com/a/129brew install https://raw.github.com/Homebrew

2015-09-25 12:42:19 320

原创 Minimum Path Sum

Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.Note: You can only move either down or right at

2015-09-13 10:29:28 253

原创 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-13 09:42:23 303

原创 Generate Parentheses

Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set is:"((()))", "(()())", "(())()", "()(())", "()()

2015-09-13 09:22:39 274

转载 字符串和编码

原文链接:http://www.liaoxuefeng.com/wiki/001374738125095c955c1e6d8bb493182103fac9270762a000/001386819196283586a37629844456ca7e5a7faa9b94ee8000字符编码我们已经讲过了,字符串也是一种数据类型,但是,字符串比较特殊的是还有一个编码问题。

2015-09-11 13:14:21 276

原创 Gray Code

The gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integer n representing the total number of bits in the code, print the sequence of

2015-09-09 17:33:20 253

转载 <二叉树 前中后 层序 非递归遍历 c语言实现>

非递归遍历要用到stack,出栈即访问前序遍历:(中结点->左结点->右节点) 思路:先将根节点入栈,之后进入循环,先出栈一个结点A,  之后如果存在的话,将A的右结点入栈,再将A的左结点入栈,之后继续循环。。这样一直循环到栈空为止。中序遍历:   (左结点->中结点->右节点)思路:扫描根节点,将其所有左孩子结点全部入栈, 之后出栈

2015-09-06 18:20:30 500

转载 Unique Binary Search Trees

Given n, how many structurally unique BST's (binary search trees) that store values 1...n?For example,Given n = 3, there are a total of 5 unique BST's. 1 3 3 2 1 \

2015-09-02 17:38:15 180

转载 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 e

2015-08-31 11:54:30 283

原创 House Robber

You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent house

2015-08-25 16:39:23 249

原创 Factorial Trailing Zeroes

Given an integer n, return the number of trailing zeroes in n!.Note: Your solution should be in logarithmic time complexity.只有偶数和5(或5的倍数)相乘才会出现0,所以,可以在n之前看看有多少个偶数和5就行了,又发现偶数的数量一定多于5的个数,于是我们只看n

2015-08-24 21:46:59 273

原创 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

2015-08-22 10:50:46 263

原创 Compare Version Numbers

Compare two version numbers version1 and version2.If version1 > version2 return 1, if version1 version2 return -1, otherwise return 0.You may assume that the version strings are non-empty and cont

2015-08-21 20:22:47 261

原创 Intersection of Two Linked Lists

Write a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked lists: A: a1 → a2 ↘

2015-08-21 15:10:35 226

原创 Binary Tree Paths

Given a binary tree, return all root-to-leaf paths.For example, given the following binary tree: 1 / \2 3 \ 5All root-to-leaf paths are:["1->2->5", "1->3"]/* use

2015-08-20 19:31:17 232

原创 Binary Tree Level Order Traversal

Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).For example:Given binary tree {3,9,20,#,#,15,7}, 3 / \ 9 20

2015-08-15 18:05:40 231

原创 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?这题实际上和费波那契数列很像。上n层楼梯的方法总数s(n

2015-08-13 10:42:02 344

原创 int b[m][n]和int **b——关于数组名和指针的关系这件“小事”

#includeint pa(int *a){ return a[3];};int pb(int **b){ return b[1][4];};int main(){ int a[] = { 1,2,3,4,5 }; int b[][5] = { {1,2,3,4,5},{6,7,8,9,10} }; printf("%d\t%d\n",a[3],b[1][4

2015-08-01 17:27:32 881

原创 LeetCode OJ Summary,Problems 1 - 15

前15题总结:1.Two Sum,使用两种方法:一、快速排序+二分查找;二、哈希表。巩固了二分查找的写法,学习了哈希表的算法,但自己实现的效果不佳。(medium)2.Add Two Numbers,考察的是链表的操作。(easy)3.Longest Substring Without Repeating Characters,哈希表+字符串。(medium)

2015-06-27 16:39:11 342

原创 3Sum

Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note:Elements in a triplet (a,b,c

2015-06-26 11:29:29 320

原创 Longest Common Prefix

Write a function to find the longest common prefix string amongst an array of strings.初看到这道题有点被迷惑了,先是看到参数里竟然有char **strs声明的两重指针,不过仔细一想,其实不就是存字符指针的数组么,每个字符指针再指向一个字符串。然后再想了想,若要找到几个字符串的最长的共同前缀,那么这个前缀自然

2015-06-26 11:26:23 292

原创 Roman to Integer

Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.根据上次题目的想法,弄一个字符指针数组,对s进行扫描的过程中,查找是否与数组里对应的字符串匹配。如果匹配上,即可得到相应数位的值。本身一道简单题,思路很快就有了,但

2015-06-25 16:21:04 223

原创 Integer to Roman

Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.目前做过的最简单的一道medium的题目,没有数学,没有算法,百度下搞懂罗马数字是怎么回事就行。不过做完后通过看别人的解题,倒是发现“指针数组”这个不错的数据结构,

2015-06-24 16:58:28 220

原创 Container With Most Water

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). Fin

2015-06-23 19:22:03 242

原创 Palindrome Number

Determine whether an integer is a palindrome. Do this without extra space. Some hints:Could negative integers be palindromes? (ie, -1) If you are thinking of converting the integer to stri

2015-06-13 11:15:11 228

原创 Reverse Integer

Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321click to show spoilers.Have you thought about this?Here are some good questions to ask before codin

2015-06-12 17:01:23 238

原创 String to Integer (atoi)

Implement atoi to convert a string to an integer.Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible input ca

2015-06-12 16:37:21 258

原创 关于const char *s和char * const s

首先要明确的一点,无论是const char *s还是char * const s,这里的s都是指针。我对这两种声明的理解方式是:看const右边接的是什么,则const修饰的就是什么。const char *s中,可以把const右边分成char和(*s)两个部分看,显然char和(*s)在代码里指的都是字符,所以const char *s指的是s指向的字符(串)是常量,不能修改,而s指

2015-06-10 19:43:17 1918

原创 ZigZag Conversion

The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)P A H NA P L S I

2015-06-08 11:14:11 291

原创 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-06-08 09:43:05 295

原创 Median of Two Sorted Arrays

There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).这道题拿到手里真的是没什么想法。唯一想到能

2015-06-02 19:01:15 229

原创 Longest Substring Without Repeating Characters

Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for "abcabcbb" is "abc", which the length is 3. Fo

2015-06-01 09:20:34 231

原创 Two Sum

The function twoSum should return indices of the two numbers such that they add up to the target, where index1 must be less than index2. Please note that your returned answers (both index1 and index

2015-05-30 16:27:22 288

原创 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-05-30 09:56:55 290

空空如也

空空如也

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

TA关注的人

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