自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

MoM

I have to believe myself

  • 博客(112)
  • 资源 (1)
  • 收藏
  • 关注

原创 [LeetCode325] Maximum Size Subarray Sum Equals k

Given an array nums and a target value k, find the maximum length of a subarray that sums to k. If there isn't one, return 0 instead.Example 1:Given nums = [1, -1, 5, -2, 3], k = 3,return 4. (because

2016-01-08 15:34:02 1968

原创 [LeetCode317]Shortest Distance from All Buildings

You want to build a house on an empty land which reaches all buildings in the shortest amount of distance. You are given a 2D grid of values 0, 1 or 2, where:Each 0 marks an empty land which you can pa

2015-12-17 03:59:18 2459

原创 [LeetCode315] Count of Smaller Numbers After Self

我靠!弄了一个小时!class node{public: int height, size, val; node *left, *right; node(int val){ this->val = val; this->height = 1; this->size = 1; this->left = this-

2015-12-07 09:41:37 765

原创 [LeetCode314]Binary Tree Vertical Order Traversal

Given a binary tree, return the vertical order traversal of its nodes' values. (ie, from top to bottom, column by column).If two nodes are in the same row and column, the order should be from left to r

2015-12-07 07:08:17 1699 1

原创 [LeetCode222]Count Complete Tree Nodes

Given a complete binary tree, count the number of nodes.Definition of a complete binary tree from Wikipedia:In a complete binary tree every level, except possibly the last, is completely filled, and a

2015-12-04 14:48:55 331

原创 [LeetCode212] Word Search II

HARDGiven a 2D board and a list of words from the dictionary, find all words in the board.Each word must be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those hori

2015-12-04 04:49:52 417

原创 [LeetCode202]Happy Number

Write an algorithm to determine if a number is "happy".A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squares of i

2015-12-03 05:43:41 393

原创 [LeetCode187]Repeated DNA Sequences

All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACGAATTCCG". When studying DNA, it is sometimes useful to identify repeated sequences within the DNA.Write a

2015-12-02 08:43:02 277

原创 [LeetCode164]Maximum Gap

HARDGiven an unsorted array, find the maximum difference between the successive elements in its sorted form.Try to solve it in linear time/space.Return 0 if the array contains less than 2 elements.You

2015-11-30 13:06:24 385

原创 [LeetCode311]Sparse Matrix Multiplication

Given two sparse matrices A and B, return the result of AB.You may assume that A's column number is equal to B's row number.Example: A = [ [ 1, 0, 0], [-1, 0, 3] ] B = [ [ 7

2015-11-29 07:33:29 2232

原创 [LeetCode308]Range Sum Query 2D - Mutable

Given 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 Query 2DThe above rectangle (wit

2015-11-29 07:27:19 4468

原创 [LeetCode305]Number of Islands II

Hard..A 2d grid map of m rows and n columns is initially filled with water. We may perform an addLand operation which turns the water at position (row, col) into a land. Given a list of positions to op

2015-11-29 07:24:44 830

原创 [LeetCode302]Smallest Rectangle Enclosing Black Pixels

Hard ..An image is represented by a binary matrix with 0 as a white pixel and 1 as a black pixel. The black pixels are connected, i.e., there is only one black region. Pixels are connected horizontally

2015-11-29 07:18:09 720

原创 [LeetCode298]Binary Tree Longest Consecutive Sequence

Given a binary tree, find the length of the longest consecutive sequence path.The path refers to any sequence of nodes from some starting node to any node in the tree along the parent-child connections

2015-11-29 07:12:38 596

原创 [LeetCode296]Best Meeting Point

A group of two or more people wants to meet and minimize the total travel distance. You are given a 2D grid of values 0 or 1, where each 1 marks the home of someone in the group. The distance is calcul

2015-11-29 07:07:54 435

原创 [LeetCode294]Flip Game II

You are playing the following Flip Game with your friend: Given a string that contains only these two characters: + and -, you and your friend take turns to flip two consecutive "++" into "--". The gam

2015-11-29 07:05:11 545

原创 [LeetCode293] Flip Game

EasyYou are playing the following Flip Game with your friend: Given a string that contains only these two characters: + and -, you and your friend take turns to flip two consecutive "++" into "--". The

2015-11-29 06:57:29 944

原创 [LeetCode291]Word Pattern II

Given 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 substring in str.Exampl

2015-11-29 06:54:06 487

原创 [LeetCode288]Unique Word Abbreviation

An abbreviation of a word follows the form <first letter><number><last letter>. Below are some examples of word abbreviations:a) it --> it (no abbreviation) 1b) d|o|g

2015-11-26 13:17:43 575

原创 [LeetCode286]Walls and Gates

You are given a m x n 2D grid initialized with these three possible values.1.-1 - A wall or an obstacle.2.0 - A gate.3.INF - Infinity means an empty room. We use the value 231 - 1 = 2147483647 to rep

2015-11-26 09:10:53 418

原创 [LeetCode285]Inorder Successor in BST

Given a binary search tree and a node in it, find the in-order successor of that node in the BST.Note: If the given node has no in-order successor in the tree, return null.Hide Tags TreeHide Similar P

2015-11-26 08:22:47 968

原创 [LeetCode282]Closest Binary Search Tree Value II

Given a non-empty binary search tree and a target value, find k values in the BST that are closest to the target.Note:Given target value is a floating point.You may assume k is always valid, that is:

2015-11-26 06:26:34 339

原创 [LeetCode271]Encode and Decode Strings

Design an algorithm to encode a list of strings to a string. The encoded string is then sent over the network and is decoded back to the original list of strings.Machine 1 (sender) has the function:str

2015-11-26 06:07:30 608

原创 [LeetCode281]Zigzag Iterator

Given two 1d vectors, implement an iterator to return their elements alternately.For example, given two 1d vectors:v1 = [1, 2]v2 = [3, 4, 5, 6]By calling next repeatedly until hasNext returns false,

2015-11-26 05:58:57 388

原创 [LeetCode280] Wiggle Sort

Given an unsorted array nums, reorder it in-place such that nums[0] <= nums[1] >= nums[2] <= nums[3]....For example, given nums = [3, 5, 2, 1, 6, 4], one possible answer is [1, 6, 2, 5, 3, 4].Hide Comp

2015-11-26 05:49:22 361

原创 [LeetCode277]Find the Celebrity

Suppose you are at a party with n people (labeled from 0 to n - 1) and among them, there may exist one celebrity. The definition of a celebrity is that all the other n - 1 people know him/her but he/sh

2015-11-26 05:41:48 364

原创 [LeetCode276]Paint Fence

There is a fence with n posts, each post can be painted with one of the k colors.You have to paint all the posts such that no more than two adjacent fence posts have the same color.Return the total num

2015-11-26 05:33:49 958

原创 [LeetCode270]Closest Binary Search Tree Value

Given a non-empty binary search tree and a target value, find the value in the BST that is closest to the target.Note: Given target value is a floating point. You are guaranteed to have only on

2015-11-26 04:28:46 457

原创 [LeetCode269]Alien Dictionary

There is a new alien language which uses the latin alphabet. However, the order among letters are unknown to you. You receive a list of words from the dictionary, where words are sorted lexicographical

2015-11-26 04:06:30 2039 1

原创 [LeetCode267]Palindrome Permutation II

Given a string s, return all the palindromic permutations (without duplicates) of it. Return an empty list if no palindromic permutation could be form.For example:Given s = "aabb", return ["abba", "baa

2015-11-26 03:26:15 722

原创 [LeetCode266]Palindrome Permutation

Given a string, determine if a permutation of the string could form a palindrome.For example,"code" -> False, "aab" -> True, "carerac" -> True.Hint: *Consider the palindromes of odd vs even length.

2015-11-26 03:06:55 439

原创 [LeetCode265]Paint House II

There are a row of n houses, each house can be painted with one of the k colors. The cost of painting each house with a certain color is different. You have to paint all the houses such that no two adj

2015-11-26 02:58:41 545

原创 [LeetCode261] Graph Valid Tree

Given n nodes labeled from 0 to n - 1 and a list of undirected edges (each edge is a pair of nodes), write a function to check whether these edges make up a valid tree.For example:Given n = 5 and edges

2015-11-25 12:45:28 960

原创 [LeetCode259]3Sum Smaller

Given an array of n integers nums and a target, find the number of index triplets i, j, k with 0 <= i < j < k < n that satisfy the condition nums[i] + nums[j] + nums[k] < target.For example, given nums

2015-11-25 12:16:25 352

原创 [LeetCode256]Paint House

There are a row of n houses, each house can be painted with one of the three colors: red, blue or green. The cost of painting each house with a certain color is different. You have to paint all the hou

2015-11-25 12:01:45 628

原创 [LeetCode255]Verify Preorder Sequence in Binary Search Tree

Given an array of numbers, verify whether it is the correct preorder traversal sequence of a binary search tree.You may assume each number in the sequence is unique.Follow up:Could you do it using onl

2015-11-25 11:53:39 688

原创 [LeetCode254]Factor Combinations

Numbers can be regarded as product of its factors. For example,8 = 2 x 2 x 2; = 2 x 4.Write a function that takes an integer n and return all possible combinations of its factors.Note: Each combina

2015-11-25 09:42:45 695

原创 [LeetCode253]Meeting Rooms II

Given an array of meeting time intervals consisting of start and end times [[s1,e1],[s2,e2],...] (si < ei), find the minimum number of conference rooms required.For example,Given [[0, 30],[5, 10],[15,

2015-11-25 09:10:05 482

原创 [LeetCode252]Meeting Rooms

Given an array of meeting time intervals consisting of start and end times [[s1,e1],[s2,e2],...] (si < ei), determine if a person could attend all meetings.For example,Given [[0, 30],[5, 10],[15, 20]]

2015-11-25 08:18:07 561

原创 [LeetCode251]Flatten 2D Vector

Implement an iterator to flatten a 2d vector.For example,Given 2d vector =[ [1,2], [3], [4,5,6]]By calling next repeatedly until hasNext returns false, the order of elements returned by next s

2015-11-25 08:12:22 491

computer architecture 5th

计算机体系结构第五版应为电子书,是最新版的英文电子书,欢迎大家共享。

2013-10-05

空空如也

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

TA关注的人

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