惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
SegmentFault 最新的问题
B
Blog
P
Proofpoint News Feed
美团技术团队
The GitHub Blog
The GitHub Blog
Y
Y Combinator Blog
A
About on SuperTechFans
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Vercel News
Vercel News
有赞技术团队
有赞技术团队
小众软件
小众软件
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Google DeepMind News
Google DeepMind News
Martin Fowler
Martin Fowler
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
aimingoo的专栏
aimingoo的专栏
H
Help Net Security
罗磊的独立博客
L
LangChain Blog
GbyAI
GbyAI
腾讯CDC
T
The Blog of Author Tim Ferriss
Microsoft Security Blog
Microsoft Security Blog

博客园 - zhaofeng555

欧氏距离 vs 余弦相似度 相似度2-欧式距离 相似度1-余弦相似度 Oh-My-OpenCode介绍 OpenCode 里的 Atlas / Sisyphus / Prometheus区别 安装opencode langchain第二个小例子 langchain的第一个小例子 springai第二个例子使用配置类配置chatclient springai访问本地alloma第一个例子 springai访问本地alloma的qwen3报错 C/c++趣味程序百例 mac 安装stale disffusion笔记 mac 安装TA-Lib包 centos7 install docker CentOS7 内核升级从3.10升级到4.4(以kernel-lt 为例) 一个数组中有一个重复的数字,O(n) 找出来 mysql server 端命令 mac安装python3 pandas tushare
找数组中重复的数字
zhaofeng555 · 2019-08-21 · via 博客园 - zhaofeng555
一个数组中有一个重复的数字,空间复杂度O(1),时间复杂度O(n)找出那个重复的数字。
public class QuChong {
public static void main(String[] args) {
int n = 4;
int[] arr = {1, 2, 3, 2};
int x = 0;
for (int i = 0; i <= n - 1; i++) {
x = x ^ i;
}
for (int i = 0; i < n; i++) {
x = x ^ arr[i];
}
System.out.println(x);
}
}