创建一个类,通过位运算中的”^"异或运算符把字符串与一个指定的值进行异或运算,从而改变字符串每个字符的值,这样就可以得到一个加密后的字符串.当把加密后的字符串作为程序输入内容,再与那个指定的值进行异或运算,实现把加密后的字符串还原为原有字符串的值. import java.util.Scanner; public class Example { public static void main(String[] args) { Scanner scan = new Scanner(System.i…
1.题目大意 Given an array of integers, every element appears twice except for one. Find that single one. Note:Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory? 给定一个数组的整数,数组中的每个元素都出现了两次.例外地,有一个元素只出现…
https://leetcode.com/problems/bitwise-and-of-numbers-range/ [n,m]区间的合取总值就是n,m对齐后前面一段相同的数位的值 比如 5:101 7:111 结果就是 4:100 class Solution { public: int rangeBitwiseAnd(int m, int n) { int len = 0; long long tmp = 1; for(;tmp <= n || tmp <= m;len++){tmp&l…