当前位置:网站首页>数组 只出现一次的数字
数组 只出现一次的数字
2022-06-10 20:50:00 【Morris_】
题目:只出现一次的数字
说明:给定一个非空整数数组,除了某个元素只出现一次以外,其余每个元素均出现两次。找出那个只出现了一次的元素。
- Swift
/* 题目:只出现一次的数字 说明:给定一个非空整数数组,除了某个元素只出现一次以外,其余每个元素均出现两次。找出那个只出现了一次的元素。 */
func singleNums(_ nums: [Int]) -> Int {
for i in 0..<nums.count {
var sigle: Bool = true
for j in 0..<nums.count {
if (j != i && nums[i] == nums[j]) {
sigle = false
break
}
}
if (sigle) {
return nums[i]
}
}
return 0
}
边栏推荐
- 【Microsoft Azure 的1024种玩法】七十五.云端数据库迁移之快速将阿里云RDS SQL Server无缝迁移到Azure SQL Databas
- Share some information I accumulated when I was working as a dotnet9 blog site
- [nk] 牛客月賽51 G計算題
- 自媒体视频创作如何选择领域?
- Leetcode advanced road - 125 Validate palindrome string
- 防抖和节流
- 用少儿编程思维塑造青少年领悟能力
- Install MySQL on Linux system. Problems encountered in xshell
- 19 MySQL optimizations commonly used in projects
- 初中毕业生,选择中职学校也可以升入高等学府
猜你喜欢

Exec function of PHP

Constructing the implementation strategy of steam education for children

Intelligent robot making progress in imitation learning

Introduction to database system -- Chapter 1 -- Introduction (important knowledge points)
CentOS7安装MySQL8的超级详细教程(无坑!)

Interpreting the new ecology of education in maker space

【Microsoft Azure 的1024种玩法】七十五.云端数据库迁移之快速将阿里云RDS SQL Server无缝迁移到Azure SQL Databas

Abbexa cell free DNA kit instructions

C language -- 7 operators

Abbexa 1,3-dipalmitonin CLIA kit solution
随机推荐
目标检测相关概念的理解
19 MySQL optimizations commonly used in projects
Exec function of PHP
Realize OSD reverse color on YUV image according to background color
C language -- 4 first-time constant
NFT copyright / royalties
In 2021, the average salary will be released, and the IT industry will not be surprised
PMP candidates, there are these places for PMP examination in Shenzhen in June 2022
Abbexa acrylamide peg NHS instructions
【北大青鸟昌平校区】职教与普教协调发展,今年的中考会容易吗?
【MySQL】表数据的增删查改(DML)
C language -- 3 variables for beginners
【MySQL】表结构的增删查改操作(DDL)
01js basic null and undefined difference type conversion = = code block logical operator
[nk] 牛客月赛51 G计算题
Acl2022 | bert2bert: an efficient pre training method of parameter reuse, which significantly reduces the training cost of oversized models
Detailed steps and actual records of SQL server2019 installation (available for hands-on test)
[Warning] TIMESTAMP with implicit DEFAULT value is deprecated
MySQL范围查询优化的场景实例详解
[NK] question de calcul de 51 g pour le match lunaire Bullock