上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 53 下一页
摘要: Given a string S of lowercase letters, a duplicate removal consists of choosing two adjacent and equal letters, and removing them. We repeatedly make 阅读全文
posted @ 2020-02-07 08:18 北叶青藤 阅读(140) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number. An example is the root-to-leaf path 1->2->3 whic 阅读全文
posted @ 2020-02-07 08:11 北叶青藤 阅读(131) 评论(0) 推荐(0) 编辑
摘要: Given the root node of a binary search tree, return the sum of values of all nodes with value between L and R (inclusive). The binary search tree is g 阅读全文
posted @ 2020-02-07 07:50 北叶青藤 阅读(268) 评论(0) 推荐(0) 编辑
摘要: 给两个bst,把它们的值按照从小到大打印。 1 public static void print2BSTInorder(TreeNode n1, TreeNode n2, List<Integer> result) { 2 Stack<TreeNode> stack1 = new Stack<>() 阅读全文
posted @ 2020-02-07 07:02 北叶青藤 阅读(94) 评论(0) 推荐(0) 编辑
摘要: Given two non-negative integers num1 and num2 represented as string, return the sum of num1 and num2. Note: The length of both num1 and num2 is < 5100 阅读全文
posted @ 2020-02-07 06:38 北叶青藤 阅读(165) 评论(0) 推荐(0) 编辑
摘要: byte swap一个 32位数 0x12345678 --> 0x78563412先是用了俩高低位mask 两两交换,不满意。然后用了一个mask,每次取一个byte,移位异或ans。一共执行四次,还是不满意。提示说用两步,能不能先交换 LSB 和 MSB,写了一下,但还是想不出怎么写。。。正解: 阅读全文
posted @ 2020-02-07 03:49 北叶青藤 阅读(727) 评论(0) 推荐(0) 编辑
摘要: 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 北叶青藤 阅读(161) 评论(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 北叶青藤 阅读(181) 评论(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 北叶青藤 阅读(142) 评论(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 北叶青藤 阅读(301) 评论(0) 推荐(0) 编辑
上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 53 下一页