- 博客(33)
- 收藏
- 关注
原创 leetcode之Permutation Sequence解题思路
题目如下:The set [1,2,3,…,n] contains a total of n! unique permutations.By listing and labeling all of the permutations in order,We get the following sequence (ie, for n = 3):"123""132""
2014-07-23 21:03:49
890
原创 leetcode 之Spiral Matrix I 和 II 解题思路
题目如下:Spiral Matrix My SubmissionsGiven a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order.For example,Given the following matrix:
2014-07-22 18:29:34
863
原创 leetcode 之 Permutations 解题思路
题目如下:Given a collection of numbers, return all possible permutations.For example,[1,2,3] have the following permutations:[1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], and [3,2,1].解法
2014-07-21 14:20:24
768
原创 leetcode 之 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 seque
2014-07-16 22:40:43
973
原创 leetcode 之Rotate List 解题思路
题目如下:Given a list, rotate the list to the right by k places, where k is non-negative.For example:Given 1->2->3->4->5->NULL and k = 2,return 4->5->1->2->3->NULL.题意:将lianbia
2014-07-12 22:50:10
776
原创 leetcode之Validate Binary Search Tree解决思路
题目如下:Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node contains only nodes with keys less than the node's
2014-07-12 14:45:28
896
原创 leetcode 之Binary Tree Level Order Traversal I和II 解题思路
题目如下: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 / \
2014-07-11 23:43:09
2593
原创 leetcode 之 Flatten Binary Tree to Linked List 解决思路
题目如下:Given a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / \ \ 3 4 6The flattened tree should look like: 1
2014-07-08 10:30:51
707
原创 leetcode 之 Two Sum 解题思路
题目如下;Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two numbers such that they add up to the targ
2014-07-06 20:50:54
1162
原创 leetcode 之Populating Next Right Pointers in Each Node II解题思路
Follow up for problem "Populating Next Right Pointers in Each Node".What if the given tree could be any binary tree? Would your previous solution still work?Note:You may only use constant
2014-06-26 22:26:35
642
原创 leetcode 之Populating Next Right Pointers in Each Node解题思路
题目如下:Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; }Populate each next pointer to point to its next r
2014-06-26 22:09:52
768
转载 leetcode 之 Copy List with Random Pointer
题目如下:A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null.Return a deep copy of the list.题目大意:深拷贝一个链表,链表除了含有
2014-06-24 16:43:55
553
原创 LeetCode 之 LRU Cache解决思路
Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations:get and set.get(key) - Get the value (will always be positive) of the key if
2014-06-24 15:56:03
837
原创 LeetCode之 Reorder List解决思路
题目如下:Given a singly linked list L: L0→L1→…→Ln-1→Ln,reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→…You must do this in-place without altering the nodes' values.For example,Given {1,2,3,4}, reorder i
2014-06-23 14:37:58
678
原创 leetcode之 wordBreak(1)解决思路
题目为:Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words.For example, givens = "leetcode",di
2014-06-18 20:21:14
803
转载 myeclipse 实现可视化JSP开发
最近开始学习JSP,以前学习.net时知道visaul studio 可以拖放可视化控件,一直以为java开发一定得自己将所有代码手工敲入,后来知道NetBeans可以,以为只有NetBeans可以,但是还是一直习惯用MyEclipse了,今天发现了原来MyEclipse在开发页面时是可以拖放可视化控件的。MyEclipse中默认的与.jsp格式的文件关联的程序是Web Page Ed
2014-04-18 15:43:38
7090
转载 java 访问权限
JAVA访问权限控制 |阅Java的访问权限控制修饰符,从最大权限到最小权限依次是:public、protected、包访问权限(默认,没有关键字)和private。对于类的访问权限只能是:public和包访问权限(但内部类可以是private或protected的);对于类中的成员的访问权限可以是上述的四种。下面是各种访问权限的作用。
2014-04-15 20:37:06
732
转载 如何在myeclipse中更改servlet模板
原Servlet模板实例[html] view plaincopyspan style="font-size:18px">package www.youkuaiyun.com.servlet; import java.io.IOException; import java.io.PrintWriter; import javax
2014-04-15 10:57:27
783
转载 ubuntu12.04 安装JDK
先去 Oracle下载Linux下的JDK压缩包,我下载的是jdk-7u4-linux-i586.tar.gz文件,下好后直接解压Step1:# 将解压好的jdk1.7.0_21文件夹用最高权限复制到/usr/lib/jvm目录里sudo cp -r ~/jdk1.7.0_21/ /usr/lib/jvm/Step2:# 配置环境变量sudo gedit ~/.pr
2014-04-14 15:50:41
509
转载 unicode编码规则
一、Unicode与UTF-8之间的的关系Unicode只是一个符号集,它只规定了符号的二进制代码,却没有规定这个二进制代码应该如何存储。比如“二”字的unicode十六进制编码是:“4E8C”,对应二进制是:“100111010001100”共有15位,也就是说至少需要两个字节来存储;但对于unicode编码更大的字符,可能需要3个字节,甚至更多字节来存储。这样问题随之而来,在一
2014-04-13 20:53:51
5797
原创 输入域名之后发生的故事
当我们在浏览器输入域名例如www.baidu.com时,之后发生了什么?我们就能看到百度的首页面?下面将详细讲解一下该过程。 1.域名解析 浏览器拿到该域名之后,首先需要对该域名进行解析。域名只是辅助我们记忆使用的,计算机、路由器都不认识,它们眼里看到是IP地址,所以域名解析的过程就是将找到该域名对应的IP地址。 浏览器先到本地C:Windows/System32/
2014-04-03 22:14:18
1305
原创 学习servlet——tomcat目录结构、网站虚拟目录
上节主要介绍了tomcat的安装与启动,这节将介绍tomcat的目录结构,以及关于虚拟目录的相关知识 1.tomcat目录结构 进入tomcat,会发现有以下目录结构:(1)bin目录:主要存放的是一些可执行文件,例如startup.bat,可以直接双击运行的。 在jdk中,bin目录存放的也是可执行文件,所以下次看到bin目录,知道是可执行文件夹(2)conf
2014-04-02 16:04:52
2433
原创 文本文件磁盘空间分配问题
今天在win 7 32位系统下试了一下,新建一个txt文本,录入字符1,保存。文件大小居然是4KB。于是查了一些资料,大体的理解如下:磁盘是按扇区存储数据的,一个扇区大小为512B。操作系统对磁盘管理时,为了减少查找时间,比如,如果按照扇区存储,一个文件比512B大时,往往需要多个扇区,而这多个扇区不一定是在一起的,因此需要额外的查找时间。于是需要更大的分配空间来减少频繁的查找。一般是按照簇为
2014-04-01 22:50:35
1096
原创 学习servlet ——tomcat安装与启动
之前听说过tomcat,只知道是个服务器,但是不了解具体是什么?最近在看韩顺平老师的课程http://edu.51cto.com/lesson/id-6252.html,慢慢有点体会。就将今天看的内容大体梳理一下。Q1:什么是服务器?简单的说,服务器就是提供服务的机器。这台机器其实和普通的机器没有多大区别,唯一区别就是安装了服务器程序。我对服务器程序的理解是相当于图书馆借书员。以前
2014-04-01 21:28:03
748
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人