自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 Leetcood解题索引

题目列表:

2014-08-22 09:36:27 772

原创 Combination Sum

Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.The same repeated number may be chosen from C unlimited numb

2014-10-04 16:42:20 603

原创 Count and Say

The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ...1 is read off as "one 1" or 11.11 is read off as "two 1s" or 21.21 is read off as 

2014-10-03 20:27:43 713

原创 Sudoku Solver

原题:Write a program to solve a Sudoku puzzle by filling the empty cells.Empty cells are indicated by the character '.'.You may assume that there will be only one unique solution.

2014-09-27 17:11:41 728

原创 Valid Sudoku

Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules.The Sudoku board could be partially filled, where empty cells are filled with the character '.'.A partially fille

2014-09-12 19:26:41 2186

原创 fork函数简介

包括: fork函数简介fork函数的两次返回和父子进程的执行顺序简介fork()子进程与父进程之间的文件描述符问题  [cpp]view plaincopyprint? 1         1 #include                                                                          

2014-09-06 15:24:00 1175

转载 操作系统常见面试题

1、进程是并发过程中程序的执行过程2、进程的特征:结构特征动态性并发性独立性异步性3、临界区指在每个进程中访问临界资源的那段代码4,现在操作系统中申请资源的基本单位是进程,在CPU得到执行的基本单位是线程,进程是由程序段、数据段、PCB组成的5,对临界资源应采取互斥访问方式来实现共享6,P.V操作是一种低级进程通信原语7,对于记录性信号量,在执行一次P操作时,信号量的值应当

2014-09-06 15:22:27 934

原创 程序员的自我修养——操作系统篇

目录:1. 进程的有哪几种状态,状态转换图,及导致转换的事件。2. 进程与线程的区别。3. 进程通信的几种方式。4. 线程同步几种方式。5. 线程的实现方式. (用户线程与内核线程的区别)6. 用户态和核心态的区别。7. 用户栈和内核栈的区别。8. 内存池、进程池、线程池。9. 死锁的概念,导致死锁的原因,导致死锁的四个必要条件,处理死锁的四个方式,预防死锁的方

2014-09-06 15:20:04 905

原创 Search Insert Position

原题:Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.You may assume no duplicates in t

2014-09-02 18:58:47 555

原创 Search for a Range

原题:Given a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the order of O(log n).If the target is n

2014-09-02 18:42:18 642

原创 Search in Rotated Sorted Array I II

原题:Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).You are given a target value to search. If found in the ar

2014-09-01 14:36:22 641

转载 C语言实现封装、继承和多态

1、  概述C语言是一种面向过程的程序设计语言,而C++是在C语言基础上衍生来了的面向对象的语言,实际上,很多C++实现的底层是用C语言实现的,如在Visual C++中的Interface其实就是struct,查找Interface的定义,你可以发现有这样的宏定义:#ifndef Interface#define Interface struct#endi

2014-09-01 11:28:17 1121

转载 Java虚拟机学习 - 体系结构 内存模型

一:Java技术体系模块图二:JVM内存区域模型1.方法区也称"永久代” 、“非堆”,  它用于存储虚拟机加载的类信息、常量、静态变量、是各个线程共享的内存区域。默认最小值为16MB,最大值为64MB,可以通过-XX:PermSize 和 -XX:MaxPermSize 参数限制方法区的大小。

2014-08-30 18:39:51 618

原创 Longest Valid Parentheses

Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.For "(()", the longest valid parentheses substring is "()",

2014-08-30 15:51:25 607

转载 JUC (Java Util Concurrency) 基础内容概述

目录[-]转自:http://www.goldendoc.org/2011/05/juc/1. JUC概况2. 原子操作3. 指令重排4. Happens-before法则:(Java 内存模型)JMM的特性:volatile语义:5. CAS操作6. Lock 锁7. AQSAQS实现:Atomically managing synchro

2014-08-25 22:21:42 27912

原创 垃圾收集器简介

HotSpot JVM收集器              上面有7中收集器,分为两块,上面为新生代收集器,下面是老年代收集器。如果两个收集器之间存在连线,就说明它们可以搭配使用。Serial(串行GC)收集器Serial收集器是一个新生代收集器,单线程执行,使用复制算法。它在进行垃圾收集时,必须暂停其他所有的工作线程(用户线程)。是Jvm client模式下默认的新生

2014-08-25 09:42:23 5646

原创 Java面试基础

1.关于hashcode和equals何时

2014-08-23 20:12:42 653

转载 Java 程序里的内存泄漏

译序:Java 的内存泄漏,这不是一个新话题。Jim Patrick 的这篇文章早在 2001 年就写出来了。但这并不意味着 Java 的内存泄漏是一个过时了的甚至不重要的话题。相反,Java 的内存泄漏应当是每一个关心程序健壮性、稳定性和高性能的程序员所必须了解的知识。本文将揭示什么时候需要关注内存泄漏以及如何进行防止。摘要:Java 程序里也存在内存泄漏?当然。和流行的看法相反,内

2014-08-23 11:08:46 569

原创 Substring with Concatenation of All Words

原题:You are given a string, S, and a list of words, L, that are all of the same length. Find all starting indices of substring(s) in S that is a concatenation of each word in L exactly once and w

2014-08-22 14:51:24 1327

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

2014-08-22 10:16:34 587

原创 Divide Two Integers

Divide two integers without using multiplication, division and mod operator.解答:public int divide(int dividend, int divisor) { boolean negative = (dividend0) || (dividend>0 && divisor<0);

2014-08-20 19:02:56 507

原创 Remove Element

原题:Given an array and a value, remove all instances of that value in place and return the new length.The order of elements can be changed. It doesn't matter what you leave beyond the new len

2014-08-20 16:15:04 381

原创 Remove Duplicates from Sorted Array II

原题:Follow up for "Remove Duplicates":What if duplicates are allowed at most twice?For example,Given sorted array A = [1,1,1,2,2,3],Your function should return length = 5, and A is no

2014-08-19 16:13:53 399

原创 Remove Duplicates from Sorted Array

原题: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 p

2014-08-19 14:58:23 495

原创 Reverse Nodes in k-Group

原题:Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.If the number of nodes is not a multiple of k then left-out nodes in the end should remain

2014-08-18 21:24:22 451

原创 Swap Nodes in Pairs

原题: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 may not modify the values in the list, only nodes itself can be

2014-08-17 22:22:28 399

原创 Merge k Sorted Lists

原题:Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.此题可以递归的两两归并,也可以使用youxianj

2014-08-15 22:29:40 552

原创 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:"((()))", "(()())", "(())()", "()(()

2014-08-15 20:03:22 435

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

2014-08-12 19:26:11 419

原创 Remove Nth Node From End of List

原题:Given a linked list, remove the nth node from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. After removing the second node from the

2014-08-11 20:31:41 436

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

2014-08-11 17:03:27 9618 2

原创 地铁换乘(华为机试样题)

题目简介:描述:已知2条地铁线路,其中A为环线,B为东西向线路,线路都是双向的。经过的站点名分别如下,两条线交叉的换乘点用T1、T2表示。编写程序,任意输入两个站点名称,输出乘坐地铁最少需要经过的车站数量(含输入的起点和终点,换乘站点只计算一次)。地铁线A(环线)经过车站:A1 A2 A3 A4 A5 A6 A7 A8 A9 T1 A10 A11 A12 A13 T2 A14 A1

2014-03-21 22:00:04 2935 2

原创 Word Maze(单词迷宫)

Word Maze 是一个网络小游戏,你需要找到以字母标注的食物,但要求以给定单词字母的顺序吃掉。如上图,假设给定单词if,你必须先吃掉i然后才能吃掉f。    但现在你的任务可没有这么简单,你现在处于一个迷宫Maze(n×m的矩阵)当中,里面到处都是以字母标注的食物,但你只能吃掉能连成给定单词W的食物。如下图,指定W为“SOLO”,则在地图中红色标注了单词“SOLO”。

2014-03-21 10:33:36 8107 2

原创 CSDN优秀博客连接,博客之星连接。

2013年度CSDN十大博客之星TOP作者专注领域博客地址1邹晓艺机器学习及算法zouxy092王然潜在的集大成者dog2503刘伟

2014-03-02 16:22:22 12277

原创 精妙的Morris二叉树遍历算法

Morris 遍历,使用无堆栈,O(1) 空间进行二叉树遍历。它的原理很简单,利用所有叶子结点的右指针,指向其后继结点,组成一个环,在第二次遍历到这个结点时,由于其左子树已经遍历完了,则访问该结点。算法伪码:MorrisInOrder(): while 没有结束   如果当前节点没有左后代     访问该节点     转向右节

2013-09-02 10:40:10 2294

原创 忘我之乘积

题目:给你一个数组A[1..n],请你在O(n)的时间里构造一个新的数组B[1..n],使得B[i]=A[1]*A[2]*...*A[n]/A[i]。你不能使用除法运算。解法1;构建两个新的数组:C和D(为了方便解释,用了两个数组),C[i] = A[0]*…*A[i-1] = C[i-1]*A[i-1] D[i] = A[i+1]*…*A[n]

2013-07-31 20:20:37 678

原创 蓄水池抽样(Reservoir Sampling)问题

蓄水池抽样(Reservoir Sampling)问题分析问题:要求从N个元素中随机的抽取k个元素,其中N无法确定。这种应用的场景一般是数据流的情况下,由于数据只能被读取一次,而且数据量很大,并不能全部保存,因此数据量N是无法在抽样开始时确定的;但又要保持随机性,于是有了这个问题。所以搜索网站有时候会问这样的问题。这里的核心问题就是“随机”,怎么才能是随机的抽取元素

2013-07-30 22:13:38 1018

原创 多数算法(Majority Algorithm)

当一个序列中存在一个占大多数的的元素的时候(超过50%),该算法可以在O(1)空间和O(n)时间内找出这个元素。步骤:假设我们一开始从数组的开头,碰到某个元素的时候,就设置该元素为当前元素。当前出现的次数为1,后面,如果接着碰到的元素和该元素相同,则当前次数加1,否则减1。如果当前出现的次数为0,则表示当前元素不确定。如果结合我们有大多数元素这个前提的话,必然最后的结果是大于0的,而且最终

2013-07-29 16:41:19 5834 1

原创 求两个单链表的和

题目两个单链表(singly linked list),每一个节点里面一个0-9的数字, 输入就相当于两个大数了。然后返回这两个数的和(一个新list)。这两个输入的list 长度相等。 要求是:1. 不用递归。2. 要求算法在最好的情况下,只遍历两个list一次, 最差的情况下两遍。实现代码:public class AddSinglyLinkList {

2013-07-27 19:46:51 539

原创 2013 编程之美挑战赛 集会

时间限制: 2000ms 内存限制: 256MB描述在一条河的一侧,分布着 N 个村庄。这些村庄平日里需要一些贸易往来,然而商人们来回走遍每一座村庄是非常辛苦的,于是他们决定每个月都在河边举行一次集会,大家都来集会上购买需要的物品。然而在集会地点的选择上,大家却有分歧,因为谁都不愿意集会的地点离自己村庄非常远。经过一番激烈的讨论之后,大家决定要将集会地点挑选在这样一个位置:

2013-04-15 15:36:07 599

Javascript学习第一季(6)

Javascript学习第一季(6) DOM编程 让我们慢慢称为一名初级的js程序员。 然后往js匠人方向发展。

2012-09-08

空空如也

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

TA关注的人

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