随笔分类 - leetcode
摘要:1、LCS 2、CSD: 1、s1.length==0,return s2.length; 2、s2.length==0,return s1.length; 3、if s1.charat(i)==s2.charat(j),res[i][j]=res[i-1][j-1] else res[i][j]=
阅读全文
摘要:One way to serialize a binary tree is to use pre-order traversal. When we encounter a non-null node, we record the node's value. If it is a null node,
阅读全文
摘要:标题:Bitwise AND of Numbers Range通过率:25.7%难度:中等Given a range [m, n] where 0 >=1 9 n>>=110 offset+=111 return m<<offset
阅读全文
摘要:标题:Remove Linked List Elements通过率:30.5%难度:简单Remove all elements from a linked list of integers that have valueval.ExampleGiven:1 --> 2 --> 6 --> 3 -->...
阅读全文
摘要:标题:Happy Number通过率:34.3%难度:简单Write an algorithm to determine if a number is "happy".A happy number is a number defined by the following process: Start...
阅读全文
摘要:标题:Rotate List通过率:21.8%难度:中等Given a list, rotate the list to the right bykplaces, wherekis non-negative.For example:Given1->2->3->4->5->NULLandk=2,ret...
阅读全文
摘要:标题:Gas Station通过率:25.7%难度:中等There areNgas stations along a circular route, where the amount of gas at stationiisgas[i].You have a car with an unlimite...
阅读全文
摘要:标题:Reverse Linked List II通过率:26.2%难度:中等Reverse a linked list from positionmton. Do it in-place and in one-pass.For example:Given1->2->3->4->5->NULL,m=...
阅读全文
摘要:标题:Clone Graph通过率:23.7%难度:中等OJ's undirected graph serialization:Nodes are labeled uniquely.We use#as a separator for each node, and,as a separator for...
阅读全文
摘要:标题:Anagrams通过率:24.3%难度:中等Given an array of strings, return all groups of strings that are anagrams.Note: All inputs will be in lower-case.leetcode没有表述...
阅读全文
摘要:标题:Simplify Path通过率:20.1%难度:中等Given an absolute path for a file (Unix-style), simplify it.For example,path="/home/", =>"/home"path="/a/./b/../../c/", ...
阅读全文
摘要:标题:Number of Islands通过率:22.8%难度:中等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...
阅读全文
摘要:标题:3Sum Closest通过率:27.0%难度:中等Given an arraySofnintegers, find three integers inSsuch that the sum is closest to a given number, target. Return the sum...
阅读全文
摘要:标题:4Sum通过率:21.4%难度:中等Given an arraySofnintegers, are there elementsa,b,c, anddinSsuch thata+b+c+d= target? Find all unique quadruplets in the array wh...
阅读全文
摘要:标题:3Sum通过率: 16.9%难度:中等Given an arraySofnintegers, are there elementsa,b,cinSsuch thata+b+c= 0? Find all unique triplets in the array which gives the s...
阅读全文
摘要:标题:Binary Tree Right Side View通过率:27.9%难度:中等Given a binary tree, imagine yourself standing on therightside of it, return the values of the nodes you c...
阅读全文
摘要:题目:Word Break通过率:22.6%难度:中等Given a stringsand a dictionary of wordsdict, determine ifscan be segmented into a space-separated sequence of one or more ...
阅读全文
摘要:标题:House Robber通过率:27.5%难度:简单You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, th...
阅读全文
摘要:标题:Construct Binary Tree from Inorder and Postorder Traversal通过率:26.7%难度:中等Given inorder and postorder traversal of a tree, construct the binary tree....
阅读全文
摘要:标题:Triangle通过率:27.1%难度:中等Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.F...
阅读全文

浙公网安备 33010602011771号