From 6b833838210eb10fb5e08dcf30adf576d9f50d61 Mon Sep 17 00:00:00 2001 From: CyC2018 Date: Wed, 28 Oct 2026 13:45:07 +0800 Subject: [PATCH] =?UTF-8?q?Update=2065.=20=E4=B8=8D=E7=94=A8=E5=8A=A0?= =?UTF-8?q?=E5=87=8F=E4=B9=98=E9=99=A4=E5=81=9A=E5=8A=A0=E6=B3=95.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 题目链接改为力扣中的对应题目,题目描述和代码按该题的接口调整。 --- notes/65. 不用加减乘除做加法.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/notes/65. 不用加减乘除做加法.md b/notes/65. 不用加减乘除做加法.md index 54d4c53f..61f9f88c 100644 --- a/notes/65. 不用加减乘除做加法.md +++ b/notes/65. 不用加减乘除做加法.md @@ -2,7 +2,7 @@ ## 题目链接 -[NowCoder](https://www.nowcoder.com/practice/59ac416b4b944300b617d4f7f111b215?tpId=13&tqId=11201&tPage=1&rp=1&ru=/ta/coding-interviews&qru=/ta/coding-interviews/question-ranking&from=cyc_github) +[Leetcode](https://leetcode.cn/problems/bu-yong-jia-jian-cheng-chu-zuo-jia-fa-lcof/) ## 题目描述 @@ -15,7 +15,7 @@ a ^ b 表示没有考虑进位的情况下两数的和,(a & b) \<\< 1 就是 递归会终止的原因是 (a & b) \<\< 1 最右边会多一个 0,那么继续递归,进位最右边的 0 会慢慢增多,最后进位会变为 0,递归终止。 ```java -public int Add(int a, int b) { - return b == 0 ? a : Add(a ^ b, (a & b) << 1); +public int encryptionCalculate(int dataA, int dataB) { + return dataB == 0 ? dataA : encryptionCalculate(dataA ^ dataB, (dataA & dataB) << 1); } ```