摘要:
Sum类的题目一般这样:input: nums[], targetoutput: satisfied arrays/ lists/ number拿到题目,首先分析:1. 是几个数的sum2. sum是要求等于target还是小于还是大于还是closest3. 返回的是原数组下标还是其他对于这类题目,... 阅读全文
摘要:
QuestionGiven an array ofnintegersnumsand atarget, find the number of index tripletsi, j, kwith0 = tmpTarget) {11 end--;12 ... 阅读全文
摘要:
QuestionGiven an arraySofnintegers, find three integers inSsuch that the sum is closest to a given number, target. Return the sum of the three integer... 阅读全文
摘要:
Roman Numeral ChartV:5 X:10 L:50 C:100 D:500 M:1000规则:1. 重复次数表示该数的倍数2. 右加左减:较大的罗马数字右边记上较小的罗马数字,表示大数字加小数字较小的罗马数字右边记上较大的罗马数字,表示大数字减小数字左减的数字有限制,仅限于I... 阅读全文
摘要:
QuestionWrite a function to find the longest common prefix string amongst an array of strings.Solution第一思路是用Trie,但是对于一道Easy类别的题目,用Trie显然是杀鸡用牛刀。于是我们可以参... 阅读全文
摘要:
QuestionGiven a list of words and two wordsword1andword2, return the shortest distance between these two words in the list.For example,Assume that wor... 阅读全文
摘要:
QuestionGiven a string containing just the characters'('and')', find the length of the longest valid (well-formed) parentheses substring.For"(()", the... 阅读全文
摘要:
QuestionGiven a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.According to thedefinition of LCA on Wik... 阅读全文
摘要:
QuestionGiven a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000, and there exists one unique lo... 阅读全文
摘要:
Question Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitioning of s. F 阅读全文