随笔分类 -  leetcode

摘要:Given 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, where "adjace... 阅读全文
posted @ 2014-05-26 16:34 一弦一仙 阅读(346) 评论(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 concatenati... 阅读全文
posted @ 2014-05-26 16:33 一弦一仙 阅读(200) 评论(0) 推荐(0) 编辑
摘要:Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximu... 阅读全文
posted @ 2014-05-26 09:23 一弦一仙 阅读(155) 评论(0) 推荐(0) 编辑
摘要:Given a set of candidate numbers (C) and a target number (T), find all unique combinations inCwhere the candidate numbers sums toT.Thesamerepeated num... 阅读全文
posted @ 2014-05-22 21:41 一弦一仙 阅读(188) 评论(0) 推荐(0) 编辑
摘要:Given an arraySofnintegers, are there elementsa,b,c, anddinSsuch thata+b+c+d= target? Find all unique quadruplets in the array which gives the sum of ... 阅读全文
posted @ 2014-05-22 21:30 一弦一仙 阅读(249) 评论(0) 推荐(0) 编辑
摘要:Given a collection of candidate numbers (C) and a target number (T), find all unique combinations inCwhere the candidate numbers sums toT.Each number ... 阅读全文
posted @ 2014-05-22 21:28 一弦一仙 阅读(234) 评论(0) 推荐(0) 编辑
摘要:Given an arraySofnintegers, find three integers inSsuch that the sum is closest to a given number, target. Return the sum of the three integers. You m... 阅读全文
posted @ 2014-05-21 21:59 一弦一仙 阅读(152) 评论(0) 推荐(0) 编辑
摘要:Given an arraySofnintegers, are there elementsa,b,cinSsuch thata+b+c= 0? Find all unique triplets in the array which gives the sum of zero.Note:Elemen... 阅读全文
posted @ 2014-05-21 21:18 一弦一仙 阅读(163) 评论(0) 推荐(0) 编辑
摘要:Given a linked list and a valuex, partition it such that all nodes less thanxcome before nodes greater than or equal tox.You should preserve the origi... 阅读全文
posted @ 2014-05-21 09:43 一弦一仙 阅读(125) 评论(0) 推荐(0) 编辑
摘要:Two elements of a binary search tree (BST) are swapped by mistake.Recover the tree without changing its structure.Note:A solution using O(n) space is ... 阅读全文
posted @ 2014-05-20 22:36 一弦一仙 阅读(128) 评论(0) 推荐(0) 编辑
摘要:Evaluate the value of an arithmetic expression inReverse Polish Notation.Valid operators are+,-,*,/. Each operand may be an integer or another express... 阅读全文
posted @ 2014-05-20 14:24 一弦一仙 阅读(172) 评论(0) 推荐(0) 编辑
摘要:Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations:getandset.get(key)- Get the valu... 阅读全文
posted @ 2014-05-19 22:55 一弦一仙 阅读(220) 评论(0) 推荐(0) 编辑
摘要:Given a linked list and a valuex, partition it such that all nodes less thanxcome before nodes greater than or equal tox.You should preserve the origi... 阅读全文
posted @ 2014-05-19 11:45 一弦一仙 阅读(138) 评论(0) 推荐(0) 编辑
摘要:Determine whether an integer is a palindrome. Do this without extra space.click to show spoilers.Some hints:Could negative integers be palindromes? (i... 阅读全文
posted @ 2014-05-18 23:06 一弦一仙 阅读(149) 评论(0) 推荐(0) 编辑
摘要:Given a collection of numbers, return all possible permutations.For example,[1,2,3]have the following permutations:[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,... 阅读全文
posted @ 2014-05-18 21:20 一弦一仙 阅读(189) 评论(0) 推荐(0) 编辑
摘要:You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single ... 阅读全文
posted @ 2014-05-18 20:24 一弦一仙 阅读(103) 评论(0) 推荐(0) 编辑
摘要:Given two binary strings, return their sum (also a binary string).For example,a ="11"b ="1"Return"100".public class Solution { public String addBin... 阅读全文
posted @ 2014-05-18 19:53 一弦一仙 阅读(154) 评论(0) 推荐(0) 编辑
摘要:Given a list, rotate the list to the right bykplaces, wherekis non-negative.For example:Given1->2->3->4->5->NULLandk=2,return4->5->1->2->3->NULL.start... 阅读全文
posted @ 2014-05-18 12:02 一弦一仙 阅读(131) 评论(0) 推荐(0) 编辑
摘要:Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring. For "(()", the lo 阅读全文
posted @ 2014-05-17 17:10 一弦一仙 阅读(185) 评论(0) 推荐(0) 编辑
摘要:Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters fo... 阅读全文
posted @ 2014-05-17 15:39 一弦一仙 阅读(182) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示