2013年10月4日

N-Queens

摘要: Then-queens puzzle is the problem of placingnqueens on ann×nchessboard such that no two queens attack each other.Given an integern, return all distinct solutions to then-queens puzzle.Each solution contains a distinct board configuration of then-queens' placement, where'Q'and'.& 阅读全文

posted @ 2013-10-04 12:28 Step-BY-Step 阅读(206) 评论(0) 推荐(0) 编辑

Pow(x, n)

摘要: Implement pow(x,n). 1 public class Solution { 2 public double pow(double x, int n) { 3 // Start typing your Java solution below 4 ... 阅读全文

posted @ 2013-10-04 12:22 Step-BY-Step 阅读(205) 评论(0) 推荐(0) 编辑

Maximum Subarray

摘要: Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array[−2,1,−3,4,−1,2,1,... 阅读全文

posted @ 2013-10-04 12:17 Step-BY-Step 阅读(107) 评论(0) 推荐(0) 编辑

Spiral Matrix

摘要: Given a matrix ofmxnelements (mrows,ncolumns), return all elements of the matrix in spiral order.For example,Given the following matrix:[ [ 1, 2, 3 ],... 阅读全文

posted @ 2013-10-04 12:07 Step-BY-Step 阅读(151) 评论(0) 推荐(0) 编辑

Jump Game

摘要: 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 maximu... 阅读全文

posted @ 2013-10-04 08:05 Step-BY-Step 阅读(194) 评论(0) 推荐(0) 编辑

Merge Intervals

摘要: Given a collection of intervals, merge all overlapping intervals.For example,Given[1,3],[2,6],[8,10],[15,18],return[1,6],[8,10],[15,18].复用 Insert Interval代码即可。 1 /** 2 * Definition for an interval. 3 * public class Interval { 4 * int start; 5 * int end; 6 * Interval() { start = 0; e... 阅读全文

posted @ 2013-10-04 08:04 Step-BY-Step 阅读(242) 评论(0) 推荐(0) 编辑

Insert Interval

摘要: Given a set ofnon-overlappingintervals, insert a new interval into the intervals (merge if necessary).You may assume that the intervals were initially sorted according to their start times.Example 1:Given intervals[1,3],[6,9], insert and merge[2,5]in as[1,5],[6,9].Example 2:Given[1,2],[3,5],[6,7],[8 阅读全文

posted @ 2013-10-04 07:35 Step-BY-Step 阅读(232) 评论(0) 推荐(0) 编辑

Length of Last Word

摘要: Given a stringsconsists of upper/lower-case alphabets and empty space characters' ', return the length of last word in the string.If the last word doe... 阅读全文

posted @ 2013-10-04 06:46 Step-BY-Step 阅读(217) 评论(0) 推荐(0) 编辑

Spiral Matrix II

摘要: Given an integern, generate a square matrix filled with elements from 1 ton2in spiral order.For example,Givenn=3,You should return the following matri... 阅读全文

posted @ 2013-10-04 06:20 Step-BY-Step 阅读(172) 评论(0) 推荐(0) 编辑

Amazon 面经

摘要: [版面:待字闺中][首篇作者:gmadj] , 2013年09月29日21:51:33[首页] [上页][下页][末页] [分页:12]gmadj进入未名形象秀我的博客[回复] [回信给作者] [本篇全文] [本讨论区] [修改] [删除] [转寄] [转贴] [收藏] [举报][ 1 ]发信人: gmadj (姑妈爱大舅), 信区: JobHunting标 题: 分享一下面试题目 with update发信站: BBS 未名空间站 (Sun Sep 29 21:51:33 2013, 美东)update一下,周一,也就是昨天,已经拿到offer,具体数目还不明了=============== 阅读全文

posted @ 2013-10-04 05:20 Step-BY-Step 阅读(545) 评论(0) 推荐(0) 编辑

Permutation Sequence

摘要: The set[1,2,3,…,n]contains a total ofn! unique permutations.By listing and labeling all of the permutations in order,We get the following sequence (ie, forn= 3):"123""132""213""231""312""321"Givennandk, return thekthpermutation sequence.Not 阅读全文

posted @ 2013-10-04 02:51 Step-BY-Step 阅读(227) 评论(0) 推荐(0) 编辑

导航