当前位置:网站首页>Leecode brush question record sword finger offer 56 - ii Number of occurrences of numbers in the array II
Leecode brush question record sword finger offer 56 - ii Number of occurrences of numbers in the array II
2022-07-07 00:12:00 【Why is there a bug list】
topic
In an array nums Except that a number appears only once , The other numbers appear three times . Please find the number that only appears once .
Example 1:
Input :nums = [3,4,3,3]
Output :4
Example 2:
Input :nums = [9,1,7,9,7,9,7]
Output :1
Limit :
1 <= nums.length <= 10000
1 <= nums[i] < 2^31
answer
class Solution {
public int singleNumber(int[] nums) {
int j=0;
for(int i = 0;i<nums.length;i++)
{
if(i==j)
{
i++;
if(i==nums.length)
return nums[i-1];
}
if(nums[j]==nums[i]) {
j++; // repeated
i=0;
}
}
return nums[j];
}}
边栏推荐
- Geo data mining (III) enrichment analysis of go and KEGG using David database
- Every year, 200 billion yuan is invested in the chip field, and "China chip" venture capital is booming
- Server SMP, NUMA, MPP system learning notes.
- 【CVPR 2022】目标检测SOTA:DINO: DETR with Improved DeNoising Anchor Boxes for End-to-End Object Detection
- How to answer the dualistic opposition of Zhihu
- openresty ngx_lua子请求
- What can the interactive slide screen demonstration bring to the enterprise exhibition hall
- JS import excel & Export Excel
- TypeScript中使用类型别名
- DAY FIVE
猜你喜欢
随机推荐
kubernetes部署ldap
DAY THREE
Supersocket 1.6 creates a simple socket server with message length in the header
Personal digestion of DDD
SQL的一种写法,匹配就更新,否则就是插入
DAY TWO
What can the interactive slide screen demonstration bring to the enterprise exhibition hall
Oracle EMCC 13.5 environment in docker every minute
互动滑轨屏演示能为企业展厅带来什么
量子时代计算机怎么保证数据安全?美国公布四项备选加密算法
js导入excel&导出excel
STM32通过串口进入和唤醒停止模式
DevOps可以帮助减少技术债务的十种方式
How to find out if the U disk file of the computer reinstallation system is hidden
Designed for decision tree, the National University of Singapore and Tsinghua University jointly proposed a fast and safe federal learning system
Introduction au GPIO
[automated testing framework] what you need to know about unittest
How to answer the dualistic opposition of Zhihu
PostgreSQL highly available repmgr (1 master 2 slave +1witness) + pgpool II realizes master-slave switching + read-write separation
Why is bat still addicted to 996 when the four-day working system is being tried out in Britain?








![[automated testing framework] what you need to know about unittest](/img/4d/0f0e0a67ec41e41541e0a2b5ca46d9.png)
