自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(28)
  • 资源 (1)
  • 收藏
  • 关注

原创 LeetCode|Path Sum*

Path SumGiven a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.For example: Given the below binary tree and

2016-05-21 23:07:24 483

原创 LeetCode|Binary Tree Right Side View

Binary Tree Right Side ViewGiven a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom.For example: Given the followin

2016-05-21 20:00:07 343

原创 LeetCode|Add and Search Word - Data structure design

Add and Search Word - Data structure designDesign a data structure that supports the following two operations:void addWord(word) bool search(word) search(word) can search a literal word or a regular ex

2016-05-21 18:59:01 415

原创 LeetCode|Surrounded Regions

Surrounded RegionsGiven 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.For example,X X X X X O O

2016-05-21 15:33:41 387

原创 LeetCode|Implement Trie (Prefix Tree)

Implement Trie (Prefix Tree)Implement a trie with insert, search, and startsWith methods.Note: You may assume that all inputs are consist of lowercase letters a-z.class TrieNode { public: // Initi

2016-05-21 12:56:07 417

原创 LeetCode|Number of Islands

Given a 2d grid map of ‘1’s (land) and ‘0’s (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may assume

2016-05-21 11:40:33 346

原创 LeetCode|Search a 2D Matrix*

Search a 2D MatrixWrite an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are sorted from left to right. The first inte

2016-05-20 23:34:44 435

原创 LeetCode|Perfect Squares

Perfect SquaresGiven a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, …) which sum to n.For example, given n = 12, return 3 because 12 = 4 + 4 + 4; given

2016-05-18 20:19:45 374

原创 欢迎使用CSDN-markdown编辑器

欢迎使用Markdown编辑器写博客本Markdown编辑器使用StackEdit修改而来,用它写博客,将会带来全新的体验哦: Markdown和扩展Markdown简洁的语法 代码块高亮 图片链接和图片上传 LaTex数学公式 UML序列图和流程图 离线写博客 导入导出Markdown文件 丰富的快捷键 快捷键 加粗 Ctrl + B 斜体 Ctrl + I 引用 Ctrl

2016-05-18 20:11:49 365

原创 Sicily|1721. Gray code[Special judge]

Sicily 1721. Gray code[Special judge],生成一组格雷码

2016-05-18 09:03:38 630

原创 LeetCode|Longest Substring Without Repeating Characters

Longest Substring Without Repeating CharactersGiven a string, find the length of the longest substring without repeating characters.Examples:Given “abcabcbb”, the answer is “abc”, which the length is 3

2016-05-17 19:43:42 425

原创 Sicily|2499. 平方数

Constraints Time Limit: 1 secs, Memory Limit: 256 MB Description 费马四平方数猜想指出,任意自然数都可以分解成不超过四个完全平方数的和。 例如:144 = 122 ,14 = 12 + 22 + 32。 现在给出自然数N(N ≤ 60000),_gXX希望知道N最少可以分解成多少个完全平方数。

2016-05-15 22:03:47 574

原创 LeetCode|Count and Say

Count and SayThe count-and-say sequence is the sequence of integers beginning as follows: 1, 11, 21, 1211, 111221, …1 is read off as “one 1” or 11. 11 is read off as “two 1s” or 21. 21 is read off a

2016-05-14 22:23:38 351

原创 LeetCode|Bulb Switcher

Bulb SwitcherThere are n bulbs that are initially off. You first turn on all the bulbs. Then, you turn off every second bulb. On the third round, you toggle every third bulb (turning on if it’s off or

2016-05-14 21:55:35 447

原创 LeetCode|Set Matrix Zeroes

Set Matrix ZeroesGiven a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place.Follow up: Did you use extra space? A straight forward solution using O(mn) space is prob

2016-05-14 14:36:08 434

原创 LeetCode|Game of Life

According to the Wikipedia’s article: “The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathematician John Horton Conway in 1970.”Given a board with m by n ce

2016-05-14 10:51:22 414

原创 LeetCode|Contains Duplicate*

Contains DuplicateGiven an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the array, and it should return false if

2016-05-14 10:38:41 604

原创 LeetCode|Flatten Nested List Iterator

Given a nested list of integers, implement an iterator to flatten it.Each element is either an integer, or a list – whose elements may also be integers or other lists.Example 1: Given the list [[1,1],

2016-05-13 21:37:53 716

原创 Minimax-Tic Tac Toe

今天学了两个名词 - 完备信息 博弈双方完全知道对方的所有信息,从第一步到最后一步,所有的走法,整个棋盘看的清清楚楚,不存在随机性。德州扑克、麻将不在这个范围内,因为看不到对手的牌,而且下一次发出的牌是随机的。 - 零和博弈 也就是双方的收益之和为0。玩家A优势则玩家B必然劣势,不存在双方都是优势或者双方都是劣势的情况。Tic Tac Toe游戏比较简单,就是一个9个位置的棋盘,谁的棋子连成

2016-05-13 16:48:08 2258

原创 LeetCode|Reverse Words in a String

Reverse Words in a StringGiven an input string, reverse the string word by word.For example, Given s = “the sky is blue”, return “blue is sky the”.Update (2015-02-12): For C programmers: Try to solv

2016-05-05 08:09:12 414

原创 LeetCode|Evaluate Reverse Polish Notation

Evaluate Reverse Polish Notation Evaluate the value of an arithmetic expression in Reverse Polish Notation. Valid operators are +, -, *, /. Each operand may be an integer or another expression. Som

2016-05-05 08:06:39 323

原创 LeetCode|Rectangle Area

Rectangle Area Find the total area covered by two rectilinear rectangles in a 2D plane. Each rectangle is defined by its bottom left corner and top right corner as shown in the figure. Assume tha

2016-05-05 08:05:40 384

原创 LeetCode|Range Sum Query 2D - Immutable

Range Sum Query 2D - ImmutableGiven a 2D matrix matrix, find the sum of the elements inside the rectangle defined by its upper left corner (row1, col1) and lower right corner (row2, col2).Range Sum Que

2016-05-05 08:04:43 596

原创 LeetCode|Top K Frequent Elements

Top K Frequent ElementsGiven a non-empty array of integers, return the k most frequent elements.For example, Given [1,1,1,2,2,3] and k = 2, return [1,2].Note: You may assume k is always valid, 1 ≤ k

2016-05-03 21:52:09 352

原创 LeetCode|Kth Largest Element in an Array

Kth Largest Element in an ArrayFind the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.For example, Given [3,2,1,5,

2016-05-02 16:42:16 491

原创 LeetCode|Range Sum Query - Immutable

Range Sum Query - ImmutableGiven an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive.Example:Given nums = [-2, 0, 3, -5, 2, -1]sumRange(0, 2) -> 1 sumRange(2,

2016-05-01 17:29:11 362

原创 LeetCode|Word Pattern

Word PatternGiven a pattern and a string str, find if str follows the same pattern.Here follow means a full match, such that there is a bijection between a letter in pattern and a non-empty word in str

2016-05-01 17:15:54 326

原创 LeetCode|Excel Sheet Column Number&& Excel Sheet Column Title

Excel Sheet Column Number Title

2016-05-01 10:49:58 420

Tic Tac Toe

Tic Tac Toe的Minimax实现

2016-05-13

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除