【leetcode389】389. Find the Difference
异或 找不同 —。—
public class Solution {
public char findTheDifference(String s, String t) {
char temp = 0x00;
for(int i = 0;i < s.length();i++){
temp =(char) (temp ^ s.charAt(i));
}
for(int i = 0;i < t.length();i++){
temp =(char) (temp ^ t.charAt(i));
}
return temp;
}
}
【leetcode389】389. Find the Difference的更多相关文章
- 【LeetCode】389 Find the Difference(java)
原题 Given two strings s and t which consist of only lowercase letters. String t is generated by rando ...
- 【LeetCode】389. Find the Difference 解题报告(Java & Python)
作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 方法一:字典统计次数 方法二:异或 方法三:排序 日 ...
- 【PPT】 Least squares temporal difference learning
最小二次方时序差分学习 原文地址: https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd= ...
- 【leetcode_easy】530. Minimum Absolute Difference in BST
problem 530. Minimum Absolute Difference in BST 参考 1. Leetcode_easy_530. Minimum Absolute Difference ...
- 【leetcode】1200. Minimum Absolute Difference
题目如下: Given an array of distinct integers arr, find all pairs of elements with the minimum absolute ...
- 【LeetCode】389.找不同
389.找不同 知识点:哈希表.抵消思想: 题目描述 给定两个字符串 s 和 t,它们只包含小写字母. 字符串 t 由字符串 s 随机重排,然后在随机位置添加一个字母. 请找出在 t 中被添加的字母. ...
- 【LeetCode】1200. Minimum Absolute Difference 解题报告 (C++)
作者: 负雪明烛 id: fuxuemingzhu 个人博客:http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 排序 日期 题目地址:https://leetcode ...
- 【LeetCode】530. Minimum Absolute Difference in BST 解题报告(Java & Python)
作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 Java解法 Python解法 日期 题目地址:ht ...
- 【LeetCode】539. Minimum Time Difference 解题报告(Python)
作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.me/ 题目地址:https://leetcode.com/problems/minimum-t ...
随机推荐
- JS基础_强制类型转换
强制类型转换 将一个数据类型强制转换为其他的数据类型 类型转换主要指,将其他数据类型,转换为 string.number.boolean 1.将其他数据类型转换为string(返回值是强转后类型的值) ...
- express node 框架介绍
开篇先声明一个重点: 就是论文件模块的重要性,之前我一直以为 fs 模块不重要,后来遇到了问题,才发现我之前的自以为是是多么愚蠢的一件事,我现在知道了 fs 模块的重要性 fs 模块:用于对文件的操作 ...
- windows环境安装nexus
1.下载安装nexus安装包,我用的是nexus-2.14.13-01版本 2. 以管理员身份打开cmd命令窗口 3.进入到nexus bin目录下 输入命令 nexus install 4. 启动 ...
- leetcode-easy-math-13 Roman to Integer
mycode 97.21% class Solution(object): def romanToInt(self, s): """ :type s: str :rty ...
- 使用KFold进行训练集和验证集的拆分,使用准确率和召回率来挑选合适的阈值(threshold) 1.KFold(进行交叉验证) 2.np.logical_and(两bool数组都是正即为正) 3.np.logical_not(bool数组为正即为反,为反即为正)
---恢复内容开始--- 1. k_fold = KFold(n_split, shuffle) 构造KFold的索引切割器 k_fold.split(indices) 对索引进行切割. 参数说明:n ...
- C++类继承方式及实践
直接上图: 以及: 实践如下: #include <iostream> using namespace std; class Father{ private: int father1; i ...
- leetcode 297二叉树的序列化与反序列化
to_string(x) 将数字x转化为string atoi(x) 将char转化为int stoi(x) 将string 转化为int 采用中序遍历的顺序存储,NULL用#表示,以,分隔,O(n) ...
- [mysql]设置创建时间,更新时间未生效
问题描述: 新增一条case,create_time没有自动生成创建时间,值为空 原因 : create_time字段类型是DateTime(错误)而不是TIMESTAMP(正确) 解决办法: 把c ...
- TCP/IP,Http,Socket的区别
大学学习网络基础的时候老师讲过,网络由下往上分为物理层.数据链路层.网络层.传输层.会话层.表示层和应用层.通过初步的了解,我知道IP协议对应于网络层,TCP协议对应于传输层,而HTTP协议对应于应用 ...
- zabbix监控httpd进程、添加动作、报警媒介类型
1.在server_agent端创建脚本 mkdir -p /usr/local/etc/zabbix_scripts vi /usr/local/etc/zabbix_scripts/check_h ...