摘要: 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 ... 阅读全文
posted @ 2014-05-02 20:47 linyx 阅读(259) 评论(0) 推荐(0) 编辑
摘要: Log scale 1 %# some random data 2 x = 2.^(0:10); 3 y = rand(size(x)); 4 5 plot(log2(x), y) %# plot on log2 x-scale 6 se... 阅读全文
posted @ 2014-05-02 15:24 linyx 阅读(290) 评论(0) 推荐(0) 编辑
摘要: Valid PalindromeGiven a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a pla... 阅读全文
posted @ 2014-05-02 15:18 linyx 阅读(265) 评论(0) 推荐(0) 编辑
摘要: Minimum Depth of Binary TreeGiven a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root... 阅读全文
posted @ 2014-05-01 23:09 linyx 阅读(164) 评论(0) 推荐(0) 编辑
摘要: 递归:就是出现这种情况的代码: (或者说是用到了栈)解答树角度:在dfs遍历一棵解答树 优点:结构简洁缺点:效率低,可能栈溢出递归的一般结构:1 void f() {2 if(符合边界条件) {3 ///////4 return;5 }6 7 ... 阅读全文
posted @ 2014-05-01 15:14 linyx 阅读(623) 评论(0) 推荐(0) 编辑
摘要: Determine whether an integer is a palindrome. Do this without extra space.Some hints:Could negative integers be palindromes? (ie, -1)If you are thinki... 阅读全文
posted @ 2014-05-01 13:14 linyx 阅读(155) 评论(0) 推荐(0) 编辑
摘要: 判断valid,没有更好的方法,只能brute force。 1 class Solution { 2 public: 3 bool isValidSudoku(vector > &board) { 4 5 int n; 6 for (int... 阅读全文
posted @ 2014-05-01 01:25 linyx 阅读(199) 评论(0) 推荐(0) 编辑
摘要: Work Break IGiven a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary... 阅读全文
posted @ 2014-04-29 23:25 linyx 阅读(450) 评论(0) 推荐(0) 编辑
摘要: 听X Japan这么久,几位大叔还是没有认清,真是惭愧。X-Japan是日本著名的视觉系摇滚乐队。原来叫X,在1992年8月HEATH入团的同时改名为X JAPAN。乐队成立于1982年1月,1989年成为日本最红的乐队。1997年4月因主唱TOSHI以音乐取向不同的理由退出,在无法找到后继主音的情... 阅读全文
posted @ 2014-04-29 22:11 linyx 阅读(801) 评论(1) 推荐(0) 编辑
摘要: There are N gas stations along a circular route, where the amount of gas at station i is gas[i].You have a car with an unlimited gas tank and it costs... 阅读全文
posted @ 2014-04-27 00:27 linyx 阅读(174) 评论(0) 推荐(0) 编辑