摘要:
Given a string S of lowercase letters, a duplicate removal consists of choosing two adjacent and equal letters, and removing them. We repeatedly make 阅读全文
摘要:
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 阅读全文
摘要:
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 阅读全文
摘要:
给两个bst,把它们的值按照从小到大打印。 1 public static void print2BSTInorder(TreeNode n1, TreeNode n2, List<Integer> result) { 2 Stack<TreeNode> stack1 = new Stack<>() 阅读全文
摘要:
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 阅读全文
摘要:
byte swap一个 32位数 0x12345678 --> 0x78563412先是用了俩高低位mask 两两交换,不满意。然后用了一个mask,每次取一个byte,移位异或ans。一共执行四次,还是不满意。提示说用两步,能不能先交换 LSB 和 MSB,写了一下,但还是想不出怎么写。。。正解: 阅读全文