摘要: Given a matrix, like this[[0, 0, 1, 1, 1][0, 1, 1, 1, 1][0, 0, 1, 1, 1][0, 0, 0, 0, 0]]each cell is either 1 or 0in each row, from left to right, when 阅读全文
posted @ 2020-02-07 11:18 北叶青藤 阅读(173) 评论(0) 推荐(0) 编辑
摘要: 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) 编辑