07 2014 档案

摘要:Follow up for N-Queens problem.Now, instead outputting board configurations, return the total number of distinct solutions.The idea is the same as tha... 阅读全文
posted @ 2014-07-05 15:41 Averill Zheng 阅读(150) 评论(0) 推荐(0)
摘要:Then-queens puzzle is the problem of placingnqueens on ann×nchessboard such that no two queens attack each other.Given an integern, return all distinc... 阅读全文
posted @ 2014-07-05 15:40 Averill Zheng 阅读(155) 评论(0) 推荐(0)
摘要:Given a strings1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.Below is one possible representation... 阅读全文
posted @ 2014-07-05 14:55 Averill Zheng 阅读(219) 评论(0) 推荐(0)
摘要:Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area.public class Solution { public... 阅读全文
posted @ 2014-07-05 14:10 Averill Zheng 阅读(154) 评论(0) 推荐(0)
摘要:Given a stringSand a stringT, count the number of distinct subsequences ofTinS.A subsequence of a string is a new string which is formed from the orig... 阅读全文
posted @ 2014-07-05 08:13 Averill Zheng 阅读(214) 评论(0) 推荐(0)
摘要: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 on... 阅读全文
posted @ 2014-07-05 07:00 Averill Zheng 阅读(161) 评论(0) 推荐(0)
摘要:Given a 2D board containing'X'and'O', capture all regions surrounded by'X'.A region is captured by flipping all'O's into'X's in that surrounded region... 阅读全文
posted @ 2014-07-05 05:28 Averill Zheng 阅读(210) 评论(0) 推荐(0)
摘要:Implementint sqrt(int x).Compute and return the square root ofx.public class Solution { public int sqrt(int x) { if(x < 0) return -1; if(x =... 阅读全文
posted @ 2014-07-04 22:51 Averill Zheng 阅读(184) 评论(0) 推荐(0)
摘要:Given two words (startandend), and a dictionary, find all shortest transformation sequence(s) fromstarttoend, such that:Only one letter can be changed... 阅读全文
posted @ 2014-07-04 20:40 Averill Zheng 阅读(163) 评论(0) 推荐(0)
摘要:Given two words (startandend), and a dictionary, find the length of shortest transformation sequence fromstarttoend, such that:Only one letter can be ... 阅读全文
posted @ 2014-07-04 02:47 Averill Zheng 阅读(159) 评论(0) 推荐(0)
摘要:Given a 2D board and a word, find if the word exists in the grid.The word can be constructed from letters of sequentially adjacent cell, where "adjace... 阅读全文
posted @ 2014-07-03 09:36 Averill Zheng 阅读(234) 评论(0) 推荐(0)