摘要:
利用了只要有一位为0,那么这位和多少个1还是0与操作结果都为0 还有>=2,公共前缀之后的位数一定&出来为0 而且还利用了左右移的性质去很快速的找到公共前缀 class Solution { public int rangeBitwiseAnd(int left, int right) { int 阅读全文
摘要:
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N=sc.nextInt(); int[] x=new 阅读全文
摘要:
利用二叉搜索树中序遍历一定是升序的 /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode() {} * T 阅读全文
摘要:
class Solution { public String mergeAlternately(String word1, String word2) { int len1=word1.length(); int len2=word2.length(); int vi=0; String ans=" 阅读全文
摘要:
题目抽象出来为: 要求找到数组的子数组满足某个要求 方法一:枚举法: 子数组的一个特点就是,他有头有尾,也就是说两个变量就可以截取出来一个子数组, public class Solution { public int subarraySum(int[] nums, int k) { int coun 阅读全文