上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 34 下一页
摘要: 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) 编辑
摘要: Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).You are given a target value to search. If found in the array return its index, otherwise return -1.You may assume no duplicate exists in the array.思考:二分搜索。class Solution {publi 阅读全文
posted @ 2013-11-28 23:44 七年之后 阅读(156) 评论(0) 推荐(0) 编辑
摘要: Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.For "(()", the longest valid parentheses substring is "()", which has length = 2.Another example is ")()())", where the lo 阅读全文
posted @ 2013-11-28 13:41 七年之后 阅读(199) 评论(0) 推荐(0) 编辑
摘要: 最近正在学习Nginx,对于我这样没有基础的来讲,真的是举步维艰。但是每每我都鼓励自己勇敢的去接受新知识,相信一分耕耘一分收获! 刚看到的一则新闻:From version 207 on, systemd will not apply the settings from /etc/sysctl.conf anymore: it will only apply those from /etc/sysctl.d/*.其实这对于我学习sysctl并无影响。因为/etc/下同时保留了sysctl.conf和sysctl.d。 /proc/sys目录下存放着大多数内核参数,并且可以在系统运行时进行更改. 阅读全文
posted @ 2013-11-27 22:16 七年之后 阅读(7495) 评论(0) 推荐(2) 编辑
摘要: 之前都在虚拟机下面捣鼓Linux,有种隔靴搔痒的感觉。为了更快地熟悉Linux系统,重新安装了Ubuntu,首先就是配置vim。 下面是我的vim配置,为了方便,我在代码后添加注释说明。 1.配置C/C++风格编程方式。 sudo vi /etc/vim/vimrc,在末尾添加如下代码:""""""""""""""""文本格式和排版""""""""" 阅读全文
posted @ 2013-11-27 17:54 七年之后 阅读(330) 评论(0) 推荐(0) 编辑
摘要: Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrangement is not possible, it must rearrange it as the lowest possible order (ie, sorted in ascending order).The replacement must be in-place, do not allocate extra memory.He 阅读全文
posted @ 2013-11-27 10:38 七年之后 阅读(306) 评论(0) 推荐(0) 编辑
摘要: 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 concatena... 阅读全文
posted @ 2013-11-26 21:16 七年之后 阅读(221) 评论(0) 推荐(0) 编辑
上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 34 下一页