06 2014 档案
摘要:Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area.
阅读全文
摘要:Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.
阅读全文
摘要:Given a sorted linked list, delete all duplicates such that each element appear only once.
阅读全文
摘要:Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the histogram.
阅读全文
摘要:Follow up for "Remove Duplicates":
What if duplicates are allowed at most twice?
阅读全文
摘要:Follow up for "Search in Rotated Sorted Array":
What if duplicates are allowed?
阅读全文
摘要:Given a 2D board and a word, find if the word exists in the grid.
阅读全文
摘要:Given a set of distinct integers, S, return all possible subsets.
阅读全文
摘要:Given two integers n and k, return all possible combinations of k numbers out of 1 ... n.
阅读全文
摘要:Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).
阅读全文
摘要: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.
阅读全文
摘要: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 from left to right.
The first integer of each row is greater than the last integer of the previous row.
阅读全文
摘要:Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place.
阅读全文
摘要:Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.)
阅读全文
摘要:Given an array of words and a length L, format the text such that each line has exactly L characters and is fully (left and right) justified.
阅读全文
摘要:Implement int sqrt(int x).
阅读全文
摘要:You are climbing a stair case. It takes n steps to reach to the top.
阅读全文
摘要:Given an absolute path for a file (Unix-style), simplify it.
阅读全文
摘要:Given two binary strings, return their sum (also a binary string).
阅读全文
摘要:Validate if a given string is numeric.
阅读全文
摘要:Given a non-negative number represented as an array of digits, plus one to the number.
阅读全文
摘要:Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.
阅读全文
摘要:Follow up for "Unique Paths":
Now consider if some obstacles are added to the grids. How many unique paths would there be?
阅读全文
摘要:A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).
阅读全文
摘要: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.
阅读全文
摘要:类实例化成对象之后,可以通过对象加上"."操作符访问和操纵该对象的域和方法,但是这种访问是有限制的,通过public、protected、default(啥都不写)、private来控制。先看一个实验的例子:(不注释表示可以访问,注释掉表示无法访问)package packageA;import p...
阅读全文
摘要:File类 File 类是jam-io 包下代表与平台无关的文件和目录,也就是说如果希望在程序中操作文件和目录都可以通过File 类来完成,值得指出的是不管是文件、还是目录都是使用File 来操作的, File 能新建、删除和重命名文件和目录, File 不能访问文件内容本身。如果需要访问文件内容本...
阅读全文
摘要:基本顺序为:1 继承体系的所有静态成员初始化(先父类,后子类) 2 父类初始化完成(普通成员的初始化-->构造函数的调用) 3 子类初始化(普通成员-->构造函数) Java初始化顺序如图: 实例代码:package initialization;public class TestInit...
阅读全文
摘要:枚举类型是JDK5.0的新特征。Sun引进了一个全新的关键字enum来定义一个枚举类。下面就是一个典型枚举类型的定义:public enum Color{ RED,BLUE,BLACK,YELLOW,GREEN } 显然,enum很像特殊的class,实际上enum声明定义的类型就是一个类。...
阅读全文
摘要:简单工厂模式,工厂方法模式和抽象工厂模式都是属于创建型设计模式,这三种创建型模式都不需要知道具体类。我们掌握一种思想,就是在创建一个对象时,需要把容易发生变化的地方给封装起来,来控制变化(哪里变化,封装哪里),以适应客户的变动,项目的扩展。简单工厂模式:简单工厂没有抽象类,只有一个具体工厂类如MyF...
阅读全文
摘要:Java 的10 流是实现输入/输出的基础,它可以方便地实现数据的输入/输出操作, Java 中把不同的输入/输出源(键盘、文件、网络连接等)抽象表述为"流" (stream) ,通过流的方式允许Java 程序使用相同的方式来访问不同的输入/输出源。stream 是从起源(source) 到接收(s...
阅读全文
摘要:Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary).
阅读全文
摘要:Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string.
阅读全文
摘要:Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order.
阅读全文
摘要:The set [1,2,3,…,n] contains a total of n! unique permutations.
阅读全文
摘要:Given a list, rotate the list to the right by k places, where k is non-negative.
阅读全文
摘要:Given a collection of intervals, merge all overlapping intervals.
阅读全文
摘要:Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order.
阅读全文
摘要:Given an array of non-negative integers, you are initially positioned at the first index of the array.
阅读全文
摘要:Find the contiguous subarray within an array (containing at least one number) which has the largest sum.
阅读全文
摘要:Given an array of strings, return all groups of strings that are anagrams.
阅读全文
摘要:Implement pow(x, n).
阅读全文
摘要:Now, instead outputting board configurations, return the total number of distinct solutions.
阅读全文
摘要:The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other.
阅读全文
摘要:You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise).
阅读全文
摘要:Given an array of non-negative integers, you are initially positioned at the first index of the array.
阅读全文
摘要:Given a collection of numbers that might contain duplicates, return all possible unique permutations.
阅读全文
摘要:Given a collection of numbers, return all possible permutations.
阅读全文
摘要:Implement wildcard pattern matching with support for '?' and '*'.
阅读全文
摘要:Given two numbers represented as strings, return multiplication of the numbers as a string.
阅读全文
摘要: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.
阅读全文
摘要:Given an unsorted integer array, find the first missing positive integer.
阅读全文
摘要: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.
阅读全文
摘要: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 count-and-say sequence is the sequence of integers beginning as follows:
阅读全文
摘要:Write a program to solve a Sudoku puzzle by filling the empty cells.
阅读全文
摘要: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.
阅读全文
摘要:Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules.
阅读全文
摘要:Suppose a sorted array is rotated at some pivot unknown to you beforehand.
阅读全文
摘要:Given a sorted array of integers, find the starting and ending position of a given target value.
阅读全文
摘要:Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.
阅读全文
摘要:Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.
阅读全文
摘要: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.
阅读全文
摘要:Implement strStr().
阅读全文
摘要:Divide two integers without using multiplication, division and mod operator.
阅读全文
摘要:Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.
阅读全文
摘要:Given an array and a value, remove all instances of that value in place and return the new length.
阅读全文
摘要:Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.
阅读全文
摘要:Given a linked list, swap every two adjacent nodes and return its head.
阅读全文
摘要:Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.
阅读全文
摘要:Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.
阅读全文
摘要:Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.
阅读全文
摘要:Given a linked list, remove the nth node from the end of list and return its head.
阅读全文
摘要: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.
阅读全文
摘要: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.
阅读全文
摘要:Write a function to find the longest common prefix string amongst an array of strings.
阅读全文
摘要: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.
阅读全文
摘要:Given a roman numeral, convert it to an integer.
阅读全文
摘要:Given an integer, convert it to a roman numeral.
阅读全文
摘要:Implement regular expression matching with support for '.' and '*'.
阅读全文
摘要: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...
阅读全文
摘要:Determine whether an integer is a palindrome. Do this without extra space.
阅读全文
摘要:Implement atoi to convert a string to an integer.
阅读全文
摘要:Reverse digits of an integer.
阅读全文
摘要: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)
阅读全文
摘要: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.
阅读全文
摘要: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.
阅读全文
摘要: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.
阅读全文
摘要: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)).
阅读全文
摘要:Given an array of integers, find two numbers such that they add up to a specific target number.
阅读全文