关闭

CODE 99: 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 not found ...
阅读(361) 评论(0)

CODE 98: 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 the array....
阅读(332) 评论(0)

CODE 97: 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...
阅读(490) 评论(0)

CODE 96: 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. A sudoku...
阅读(305) 评论(0)

CODE 95: 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 "o...
阅读(414) 评论(0)

CODE 93: Combination Sum II

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. Each number in C may only be used once in the combina...
阅读(405) 评论(0)

CODE 94: 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...
阅读(343) 评论(0)

CODE 92: First Missing Positive

Given an unsorted integer array, find the first missing positive integer. For example, Given [1,2,0] return 3, and [3,4,-1,1] return 2. Your algorithm should run in O(n) time and uses constant...
阅读(439) 评论(0)

CODE 91: Trapping Rain Water

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. For example,  Given [0,1,0,2,1,0,1,3,2,1,2,1]...
阅读(420) 评论(0)

CODE 90: Multiply Strings

Given two numbers represented as strings, return multiplication of the numbers as a string. Note: The numbers can be arbitrarily large and are non-negative. public String multiply(String num1...
阅读(379) 评论(0)

无题

点击打开链接 ------------------------------------------------------------------------------------  后面是9月份以前默默的自己瞎写的内容,那时候还不知道找工作会遇到什么,哎呀,不舍得删  ------------------------------------------------------...
阅读(519) 评论(0)

CODE 89: Wildcard Matching

Implement wildcard pattern matching with support for '?' and '*'. '?' Matches any single character. '*' Matches any sequence of characters (including the empty sequence). The matching should cover t...
阅读(448) 评论(0)

CODE 88: Jump Game II

Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maximum jump length at that position. Your goal i...
阅读(463) 评论(0)

CODE 86: Permutations II

Given a collection of numbers that might contain duplicates, return all possible unique permutations. For example, [1,1,2] have the following unique permutations: [1,1,2], [1,2,1], and [2,1,1]....
阅读(380) 评论(0)

CODE 87: 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]. public Arr...
阅读(369) 评论(0)

CODE 85: Rotate Image

You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise). Follow up: Could you do this in-place? public void rotate(int[][] matrix) { // Start ...
阅读(430) 评论(0)

CODE 84: Anagrams

Given an array of strings, return all groups of strings that are anagrams. Note: All inputs will be in lower-case. public ArrayList anagrams(String[] strs) { // Note: The Solution object is...
阅读(406) 评论(0)

转一篇有关JAVA的内存泄露的文章

http://www.lybbs.net/news_read.do?newsPath=2007/9/25/1190684628458.html   1 引言      Java的一个重要优点就是通过垃圾收集器GC (Garbage Collection)自动管理内存的回收,程序员不需要通过调用函数来释放内存。因此,很多程序员认为Java 不存在内存泄漏问题,或者认为即使有内存泄漏也不是程...
阅读(389) 评论(0)

CODE 83: Pow(x, n)

Implement pow(x, n). public double pow(double x, int n) { // Note: The Solution object is instantiated only once and is reused by // each test case. boolean minus = false; double result = ...
阅读(509) 评论(0)

CODE 81: N-Queens II

Follow up for N-Queens problem. Now, instead outputting board configurations, return the total number of distinct solutions. public int totalNQueens(int n) { // Note: The Solution objec...
阅读(540) 评论(0)
199条 共10页首页 上一页 ... 6 7 8 9 10 ... 下一页 尾页
    个人资料
    • 访问:105599次
    • 积分:2773
    • 等级:
    • 排名:第14304名
    • 原创:178篇
    • 转载:21篇
    • 译文:0篇
    • 评论:9条
    文章分类
    最新评论