摘要: 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 puzzle......and its solution numbers marked in red.思考:参考这里。class Solution {public: // 返回第一个空白的位置,如果没找到就返回 (-1 阅读全文
posted @ 2013-11-29 12:35 七年之后 阅读(242) 评论(0) 推荐(0) 编辑
摘要: 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 filled sudoku which is valid.思考:参考这里。class Solution {public: bool isValidSudoku(vector > &board) { vecto 阅读全文
posted @ 2013-11-29 12:29 七年之后 阅读(185) 评论(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.You may assume no duplicates in the array.Here are few examples.[1,3,5,6], 5 → 2 [1,3,5,6], 2 → 1 [1,3,5,6], 7 → 4[1,3,5,6], 0 → 0思考:二分搜索。class So 阅读全文
posted @ 2013-11-29 12:07 七年之后 阅读(157) 评论(0) 推荐(0) 编辑
摘要: Evaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are +, -, *, /. Each operand may be an integer or another expression.Some examples: ["2", "1", "+", "3", "*"] -> ((2 + 1) * 3) -> 9 ["4", " 阅读全文
posted @ 2013-11-29 11:51 七年之后 阅读(763) 评论(0) 推荐(0) 编辑