当前位置:网站首页>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];
}}
边栏推荐
- Core knowledge of distributed cache
- app通用功能測試用例
- Quickly use various versions of PostgreSQL database in docker
- [vector retrieval research series] product introduction
- Pytest multi process / multi thread execution test case
- MySQL master-slave multi-source replication (3 master and 1 slave) setup and synchronization test
- MIT 6.824 - raft Student Guide
- 在Docker中分分钟拥有Oracle EMCC 13.5环境
- 谷歌百度雅虎都是中国公司开发的通用搜索引擎_百度搜索引擎url
- 2022/2/12 summary
猜你喜欢

48页数字政府智慧政务一网通办解决方案

pytest多进程/多线程执行测试用例
![[automated testing framework] what you need to know about unittest](/img/4d/0f0e0a67ec41e41541e0a2b5ca46d9.png)
[automated testing framework] what you need to know about unittest

Hydrogen future industry accelerates | the registration channel of 2022 hydrogen energy specialty special new entrepreneurship competition is opened!

Penetration test --- database security: detailed explanation of SQL injection into database principle

DAY THREE

Server SMP, NUMA, MPP system learning notes.

GPIO簡介

Why is bat still addicted to 996 when the four-day working system is being tried out in Britain?

DAY TWO
随机推荐
陀螺仪的工作原理
openresty ngx_lua子请求
2022 latest blind box mall complete open source operation source code / docking visa free payment interface / building tutorial
Tourism Management System Based on jsp+servlet+mysql framework [source code + database + report]
2022/2/10 summary
PDF文档签名指南
在Docker中分分钟拥有Oracle EMCC 13.5环境
【精品】pinia 基于插件pinia-plugin-persist的 持久化
Oracle EMCC 13.5 environment in docker every minute
Why is bat still addicted to 996 when the four-day working system is being tried out in Britain?
Pinia module division
Compilation of kickstart file
Google, Baidu and Yahoo are general search engines developed by Chinese companies_ Baidu search engine URL
MIT 6.824 - raft Student Guide
Automatic test tool katalon (WEB) test operation instructions
Newsletter L Huobi ventures is in-depth contact with genesis public chain
什么是响应式对象?响应式对象的创建过程?
Racher integrates LDAP to realize unified account login
MySQL master-slave multi-source replication (3 master and 1 slave) setup and synchronization test
Huawei mate8 battery price_ Huawei mate8 charges very slowly after replacing the battery