摘要:
A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). 阅读全文
posted @ 2014-06-26 23:24
jdflyfly
阅读(130)
评论(0)
推荐(0)
摘要:
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. 阅读全文
posted @ 2014-06-26 23:12
jdflyfly
阅读(139)
评论(0)
推荐(0)
摘要:
类实例化成对象之后,可以通过对象加上"."操作符访问和操纵该对象的域和方法,但是这种访问是有限制的,通过public、protected、default(啥都不写)、private来控制。先看一个实验的例子:(不注释表示可以访问,注释掉表示无法访问)package packageA;import p... 阅读全文
posted @ 2014-06-26 22:55
jdflyfly
阅读(148)
评论(0)
推荐(0)
摘要:
File类 File 类是jam-io 包下代表与平台无关的文件和目录,也就是说如果希望在程序中操作文件和目录都可以通过File 类来完成,值得指出的是不管是文件、还是目录都是使用File 来操作的, File 能新建、删除和重命名文件和目录, File 不能访问文件内容本身。如果需要访问文件内容本... 阅读全文
posted @ 2014-06-26 21:07
jdflyfly
阅读(167)
评论(0)
推荐(0)
摘要:
基本顺序为:1 继承体系的所有静态成员初始化(先父类,后子类) 2 父类初始化完成(普通成员的初始化-->构造函数的调用) 3 子类初始化(普通成员-->构造函数) Java初始化顺序如图: 实例代码:package initialization;public class TestInit... 阅读全文
posted @ 2014-06-26 21:06
jdflyfly
阅读(177)
评论(0)
推荐(0)
摘要:
枚举类型是JDK5.0的新特征。Sun引进了一个全新的关键字enum来定义一个枚举类。下面就是一个典型枚举类型的定义:public enum Color{ RED,BLUE,BLACK,YELLOW,GREEN } 显然,enum很像特殊的class,实际上enum声明定义的类型就是一个类。... 阅读全文
posted @ 2014-06-26 21:05
jdflyfly
阅读(327)
评论(0)
推荐(0)
摘要:
简单工厂模式,工厂方法模式和抽象工厂模式都是属于创建型设计模式,这三种创建型模式都不需要知道具体类。我们掌握一种思想,就是在创建一个对象时,需要把容易发生变化的地方给封装起来,来控制变化(哪里变化,封装哪里),以适应客户的变动,项目的扩展。简单工厂模式:简单工厂没有抽象类,只有一个具体工厂类如MyF... 阅读全文
posted @ 2014-06-26 21:04
jdflyfly
阅读(273)
评论(0)
推荐(0)
摘要:
Java 的10 流是实现输入/输出的基础,它可以方便地实现数据的输入/输出操作, Java 中把不同的输入/输出源(键盘、文件、网络连接等)抽象表述为"流" (stream) ,通过流的方式允许Java 程序使用相同的方式来访问不同的输入/输出源。stream 是从起源(source) 到接收(s... 阅读全文
posted @ 2014-06-26 21:03
jdflyfly
阅读(278)
评论(0)
推荐(0)
摘要:
计算机中的字符编码(转+整理)概述:一直对字符的各种编码方式懵懵懂懂,什么ANSI、UNICODE、UTF-8、GB2312、GBK、DBCS、UCS……是不是看的很晕,假如您细细的阅读本文你一定可以清晰的理解他们。Let's go!很久很久以前,有一群人,他们决定用8个可以开合的晶体管来组合成不同... 阅读全文
posted @ 2014-06-26 20:34
jdflyfly
阅读(260)
评论(0)
推荐(0)
摘要:
Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary). 阅读全文
posted @ 2014-06-26 20:15
jdflyfly
阅读(171)
评论(0)
推荐(0)
摘要:
Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string. 阅读全文
posted @ 2014-06-26 20:14
jdflyfly
阅读(146)
评论(0)
推荐(0)
摘要:
Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order. 阅读全文
posted @ 2014-06-26 20:13
jdflyfly
阅读(150)
评论(0)
推荐(0)
摘要:
The set [1,2,3,…,n] contains a total of n! unique permutations. 阅读全文
posted @ 2014-06-26 20:12
jdflyfly
阅读(260)
评论(0)
推荐(0)
摘要:
Given a list, rotate the list to the right by k places, where k is non-negative. 阅读全文
posted @ 2014-06-26 20:11
jdflyfly
阅读(195)
评论(0)
推荐(0)
摘要:
Given a collection of intervals, merge all overlapping intervals. 阅读全文
posted @ 2014-06-26 20:10
jdflyfly
阅读(159)
评论(0)
推荐(0)
摘要:
Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order. 阅读全文
posted @ 2014-06-26 20:09
jdflyfly
阅读(200)
评论(0)
推荐(0)
摘要:
Given an array of non-negative integers, you are initially positioned at the first index of the array. 阅读全文
posted @ 2014-06-26 20:08
jdflyfly
阅读(187)
评论(0)
推荐(0)
摘要:
Find the contiguous subarray within an array (containing at least one number) which has the largest sum. 阅读全文
posted @ 2014-06-26 20:07
jdflyfly
阅读(222)
评论(0)
推荐(0)
摘要:
Given an array of strings, return all groups of strings that are anagrams. 阅读全文
posted @ 2014-06-26 20:06
jdflyfly
阅读(209)
评论(0)
推荐(0)
摘要:
Implement pow(x, n). 阅读全文
posted @ 2014-06-26 20:05
jdflyfly
阅读(216)
评论(0)
推荐(0)
摘要:
Now, instead outputting board configurations, return the total number of distinct solutions. 阅读全文
posted @ 2014-06-26 20:04
jdflyfly
阅读(142)
评论(0)
推荐(0)
摘要:
The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other. 阅读全文
posted @ 2014-06-26 20:03
jdflyfly
阅读(183)
评论(0)
推荐(0)
摘要:
You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise). 阅读全文
posted @ 2014-06-26 20:02
jdflyfly
阅读(225)
评论(0)
推荐(0)
摘要:
Given an array of non-negative integers, you are initially positioned at the first index of the array. 阅读全文
posted @ 2014-06-26 20:01
jdflyfly
阅读(206)
评论(0)
推荐(0)
摘要:
Given a collection of numbers that might contain duplicates, return all possible unique permutations. 阅读全文
posted @ 2014-06-26 20:00
jdflyfly
阅读(229)
评论(0)
推荐(0)
摘要:
Given a collection of numbers, return all possible permutations. 阅读全文
posted @ 2014-06-26 19:59
jdflyfly
阅读(172)
评论(0)
推荐(0)
摘要:
Implement wildcard pattern matching with support for '?' and '*'. 阅读全文
posted @ 2014-06-26 19:58
jdflyfly
阅读(350)
评论(4)
推荐(0)
摘要:
Given two numbers represented as strings, return multiplication of the numbers as a string. 阅读全文
posted @ 2014-06-26 19:57
jdflyfly
阅读(212)
评论(0)
推荐(0)
摘要:
Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining. 阅读全文
posted @ 2014-06-26 19:56
jdflyfly
阅读(222)
评论(0)
推荐(0)
摘要:
Given an unsorted integer array, find the first missing positive integer. 阅读全文
posted @ 2014-06-26 19:55
jdflyfly
阅读(132)
评论(0)
推荐(0)
摘要:
Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T. 阅读全文
posted @ 2014-06-26 19:54
jdflyfly
阅读(428)
评论(0)
推荐(0)
摘要:
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. 阅读全文
posted @ 2014-06-26 19:53
jdflyfly
阅读(274)
评论(0)
推荐(0)
摘要:
The count-and-say sequence is the sequence of integers beginning as follows: 阅读全文
posted @ 2014-06-26 19:52
jdflyfly
阅读(178)
评论(0)
推荐(0)
摘要:
Write a program to solve a Sudoku puzzle by filling the empty cells. 阅读全文
posted @ 2014-06-26 19:49
jdflyfly
阅读(314)
评论(0)
推荐(0)
摘要:
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. 阅读全文
posted @ 2014-06-26 19:46
jdflyfly
阅读(165)
评论(0)
推荐(0)
摘要:
Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules. 阅读全文
posted @ 2014-06-26 19:45
jdflyfly
阅读(223)
评论(1)
推荐(0)
摘要:
Suppose a sorted array is rotated at some pivot unknown to you beforehand. 阅读全文
posted @ 2014-06-26 19:44
jdflyfly
阅读(199)
评论(0)
推荐(0)
摘要:
Given a sorted array of integers, find the starting and ending position of a given target value. 阅读全文
posted @ 2014-06-26 19:43
jdflyfly
阅读(209)
评论(1)
推荐(0)
摘要:
Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring. 阅读全文
posted @ 2014-06-26 19:42
jdflyfly
阅读(156)
评论(1)
推荐(0)
摘要:
Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. 阅读全文
posted @ 2014-06-26 19:41
jdflyfly
阅读(206)
评论(0)
推荐(0)
摘要:
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 without any intervening characters. 阅读全文
posted @ 2014-06-26 19:40
jdflyfly
阅读(221)
评论(0)
推荐(0)
摘要:
Implement strStr(). 阅读全文
posted @ 2014-06-26 19:35
jdflyfly
阅读(276)
评论(0)
推荐(0)
摘要:
Divide two integers without using multiplication, division and mod operator. 阅读全文
posted @ 2014-06-26 19:34
jdflyfly
阅读(293)
评论(3)
推荐(0)
摘要:
Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. 阅读全文
posted @ 2014-06-26 19:32
jdflyfly
阅读(124)
评论(0)
推荐(0)
摘要:
Given an array and a value, remove all instances of that value in place and return the new length. 阅读全文
posted @ 2014-06-26 19:31
jdflyfly
阅读(148)
评论(0)
推荐(0)
摘要:
Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. 阅读全文
posted @ 2014-06-26 19:30
jdflyfly
阅读(207)
评论(0)
推荐(0)
摘要:
Given a linked list, swap every two adjacent nodes and return its head. 阅读全文
posted @ 2014-06-26 19:28
jdflyfly
阅读(159)
评论(0)
推荐(0)
摘要:
Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 阅读全文
posted @ 2014-06-26 19:27
jdflyfly
阅读(169)
评论(0)
推荐(0)
摘要:
Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. 阅读全文
posted @ 2014-06-26 19:26
jdflyfly
阅读(173)
评论(0)
推荐(0)
摘要:
Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. 阅读全文
posted @ 2014-06-26 19:24
jdflyfly
阅读(130)
评论(0)
推荐(0)
摘要:
Given a linked list, remove the nth node from the end of list and return its head. 阅读全文
posted @ 2014-06-26 19:23
jdflyfly
阅读(160)
评论(0)
推荐(0)
摘要:
Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target. 阅读全文
posted @ 2014-06-26 19:21
jdflyfly
阅读(219)
评论(0)
推荐(0)
摘要:
Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. 阅读全文
posted @ 2014-06-26 19:20
jdflyfly
阅读(164)
评论(0)
推荐(0)
摘要:
Write a function to find the longest common prefix string amongst an array of strings. 阅读全文
posted @ 2014-06-26 19:19
jdflyfly
阅读(164)
评论(0)
推荐(0)
摘要:
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. 阅读全文
posted @ 2014-06-26 19:17
jdflyfly
阅读(178)
评论(1)
推荐(0)
摘要:
Given a roman numeral, convert it to an integer. 阅读全文
posted @ 2014-06-26 19:15
jdflyfly
阅读(129)
评论(0)
推荐(0)
摘要:
Given an integer, convert it to a roman numeral. 阅读全文
posted @ 2014-06-26 19:14
jdflyfly
阅读(155)
评论(0)
推荐(0)
摘要:
Implement regular expression matching with support for '.' and '*'. 阅读全文
posted @ 2014-06-26 19:13
jdflyfly
阅读(1834)
评论(3)
推荐(0)
摘要:
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 two lines, which together with x-axis forms a container, such that the container contains the most wa... 阅读全文
posted @ 2014-06-26 19:12
jdflyfly
阅读(236)
评论(0)
推荐(0)
摘要:
Determine whether an integer is a palindrome. Do this without extra space. 阅读全文
posted @ 2014-06-26 19:11
jdflyfly
阅读(336)
评论(0)
推荐(0)
摘要:
Implement atoi to convert a string to an integer. 阅读全文
posted @ 2014-06-26 19:10
jdflyfly
阅读(216)
评论(0)
推荐(0)
摘要:
Reverse digits of an integer. 阅读全文
posted @ 2014-06-26 19:09
jdflyfly
阅读(164)
评论(0)
推荐(0)
摘要:
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) 阅读全文
posted @ 2014-06-26 19:08
jdflyfly
阅读(154)
评论(0)
推荐(0)
摘要:
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. 阅读全文
posted @ 2014-06-26 19:07
jdflyfly
阅读(697)
评论(0)
推荐(0)
摘要:
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 linked list. 阅读全文
posted @ 2014-06-26 19:05
jdflyfly
阅读(223)
评论(0)
推荐(0)
摘要:
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. For "bbbbb" the longest substring is "b", with the length of 1. 阅读全文
posted @ 2014-06-26 19:01
jdflyfly
阅读(180)
评论(0)
推荐(0)
摘要:
There are two sorted arrays A and B 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)). 阅读全文
posted @ 2014-06-26 18:59
jdflyfly
阅读(301)
评论(0)
推荐(0)
摘要:
Given an array of integers, find two numbers such that they add up to a specific target number. 阅读全文
posted @ 2014-06-26 18:55
jdflyfly
阅读(289)
评论(1)
推荐(0)

浙公网安备 33010602011771号