当前位置:网站首页>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];
}}
边栏推荐
- Hydrogen future industry accelerates | the registration channel of 2022 hydrogen energy specialty special new entrepreneurship competition is opened!
- Random类的那些事
- Typescript incremental compilation
- The "white paper on the panorama of the digital economy" has been released with great emphasis on the digitalization of insurance
- 量子时代计算机怎么保证数据安全?美国公布四项备选加密算法
- Introduction to GPIO
- Cas d'essai fonctionnel universel de l'application
- Things like random
- Local deployment Zeppelin 0.10.1
- openresty ngx_ Lua subrequest
猜你喜欢

DAY THREE

Introduction au GPIO

DAY ONE

Close unregistering application XXX with Eureka with status down after Eureka client starts

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

DAY SIX

Zero code and high return. How to use 40 sets of templates to meet 95% of the reporting needs in the work

DAY ONE

iMeta | 华南农大陈程杰/夏瑞等发布TBtools构造Circos图的简单方法

刘永鑫报告|微生物组数据分析与科学传播(晚7点半)
随机推荐
陀螺仪的工作原理
TypeScript增量编译
【2022全网最细】接口测试一般怎么测?接口测试的流程和步骤
Designed for decision tree, the National University of Singapore and Tsinghua University jointly proposed a fast and safe federal learning system
48页数字政府智慧政务一网通办解决方案
【精品】pinia 基于插件pinia-plugin-persist的 持久化
2022 PMP project management examination agile knowledge points (9)
Racher integrates LDAP to realize unified account login
Building lease management system based on SSM framework
DAY SIX
Gradle knowledge generalization
DAY ONE
Asset security issues or constraints on the development of the encryption industry, risk control + compliance has become the key to breaking the platform
File and image comparison tool kaleidoscope latest download
Rider离线使用Nuget包的方法
Penetration test --- database security: detailed explanation of SQL injection into database principle
pytest多进程/多线程执行测试用例
iMeta | 华南农大陈程杰/夏瑞等发布TBtools构造Circos图的简单方法
Common modification commands of Oracle for tables
After leaving a foreign company, I know what respect and compliance are