摘要:
Given a string s of '(' , ')' and lowercase English characters. Your task is to remove the minimum number of parentheses ( '(' or ')', in any position 阅读全文
posted @ 2020-02-06 13:46
北叶青藤
阅读(170)
评论(0)
推荐(0)
摘要:
Given two sentences words1, words2 (each represented as an array of strings), and a list of similar word pairs pairs, determine if two sentences are s 阅读全文
posted @ 2020-02-06 12:22
北叶青藤
阅读(195)
评论(0)
推荐(0)
摘要:
给两个已经排序好的数组A,B,和一个常数k, 找i,j使得 Ai + Bj - k 的绝对值最小 分析: Two pointer, i从A从前往后扫,j从B从后往前扫.if (A[i]+B[j] > k){ j--;}else { i++;}整个过程不断更新答案 阅读全文
posted @ 2020-02-06 12:04
北叶青藤
阅读(153)
评论(0)
推荐(0)
摘要:
Suppose we have very large sparse vectors (most of the elements in vector are zeros) Find a data structure to store them Compute the Dot Product. Foll 阅读全文
posted @ 2020-02-06 11:33
北叶青藤
阅读(313)
评论(0)
推荐(0)
摘要:
Given two binary search trees root1 and root2. Return a list containing all the integers from both trees sorted in ascending order. Example 1: Input: 阅读全文
posted @ 2020-02-06 09:39
北叶青藤
阅读(529)
评论(0)
推荐(0)
摘要:
有个N叉树是个大食堂的地图。节点有的是餐馆,有的不是,在输入里面用boolean表示了。每个父节点到子节点的距离都是一。你作为一个吃货,从根节点出发,要去所有的餐馆尝尝,需要的最短路径是多少。楼主DFS返回两个量,一个是这个节点为根的树要吃完需要的走多长的路,另一个是一个flag表示这个子树里面有没 阅读全文
posted @ 2020-02-06 06:22
北叶青藤
阅读(186)
评论(0)
推荐(0)
摘要:
Given a binary tree rooted at root, the depth of each node is the shortest distance to the root. A node is deepest if it has the largest depth possibl 阅读全文
posted @ 2020-02-06 06:11
北叶青藤
阅读(115)
评论(0)
推荐(0)
摘要:
Given a matrix of M x N elements (M rows, N columns), return all elements of the matrix in diagonal order as shown in the below image. Example: Input: 阅读全文
posted @ 2020-02-06 05:45
北叶青藤
阅读(114)
评论(0)
推荐(0)

浙公网安备 33010602011771号