05 2014 档案
摘要:Remove ElementGiven an array and a value, remove all instances of that value in place and return the new length.The order of elements can be changed. ...
阅读全文
摘要:Jump Game IIGiven an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents...
阅读全文
摘要:Rotate ImageYou are given an n x n 2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up: Could you do this in-place?最简...
阅读全文
摘要: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...
阅读全文
摘要:Implement strStr()Implement strStr().Returns a pointer to the first occurrence of needle in haystack, ornullif needle is not part of haystack.解法一:暴力解c...
阅读全文
摘要:Remove Duplicates from Sorted ArrayGiven a sorted array, remove the duplicates in place such that each element appear only once and return the new len...
阅读全文
摘要:Word SearchGiven a 2D board and a word, find if the word exists in the grid.The word can be constructed from letters of sequentially adjacent cell, wh...
阅读全文
摘要:Decode WaysA message containing letters fromA-Zis being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given an encoded me...
阅读全文
摘要:Remove Duplicates from Sorted Array IIFollow up for "Remove Duplicates":What if duplicates are allowed at mosttwice?For example,Given sorted array A =...
阅读全文
摘要:Two SumGiven an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the...
阅读全文
摘要:Linked List CycleGiven a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?解法一:使用unordered_map记录当前节点...
阅读全文
摘要:TriangleGiven a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, given...
阅读全文
摘要:Best Time to Buy and Sell StockSay you have an array for which theithelement is the price of a given stock on dayi.If you were only permitted to compl...
阅读全文
摘要:Populating Next Right Pointers in Each NodeGiven a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLi...
阅读全文
摘要:Linked List Cycle IIGiven a linked list, return the node where the cycle begins. If there is no cycle, returnnull.Follow up:Can you solve it without u...
阅读全文
摘要:Jump GameGiven an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents yo...
阅读全文
摘要:Longest Consecutive SequenceGiven an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given[100, 4...
阅读全文
摘要:Sort ColorsGiven an array withnobjects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the or...
阅读全文