当前位置:网站首页>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];
}}
边栏推荐
- Use Yum or up2date to install the postgresql13.3 database
- Newsletter L Huobi ventures is in-depth contact with genesis public chain
- 2022/2/10 summary
- How to find out if the U disk file of the computer reinstallation system is hidden
- DAY SIX
- Imeta | Chen Chengjie / Xia Rui of South China Agricultural University released a simple method of constructing Circos map by tbtools
- Every year, 200 billion yuan is invested in the chip field, and "China chip" venture capital is booming
- Pinia module division
- 专为决策树打造,新加坡国立大学&清华大学联合提出快速安全的联邦学习新系统
- 2022/2/11 summary
猜你喜欢
Eureka Client启动后就关闭 Unregistering application xxx with eureka with status DOWN
Introduction to GPIO
DevOps可以帮助减少技术债务的十种方式
Wind chime card issuing network source code latest version - commercially available
Close unregistering application XXX with Eureka with status down after Eureka client starts
DAY SIX
matplotlib画柱状图并添加数值到图中
Imeta | Chen Chengjie / Xia Rui of South China Agricultural University released a simple method of constructing Circos map by tbtools
什么是响应式对象?响应式对象的创建过程?
MVC and MVVM
随机推荐
为什么完全背包要用顺序遍历?简要解释一下
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
刘永鑫报告|微生物组数据分析与科学传播(晚7点半)
Eureka Client启动后就关闭 Unregistering application xxx with eureka with status DOWN
Quickly use various versions of PostgreSQL database in docker
Penetration test --- database security: detailed explanation of SQL injection into database principle
沉浸式投影在线下展示中的三大应用特点
【CVPR 2022】半监督目标检测:Dense Learning based Semi-Supervised Object Detection
okcc呼叫中心的订单管理时怎么样的
The largest single investment in the history of Dachen was IPO today
编译logisim
【CVPR 2022】目标检测SOTA:DINO: DETR with Improved DeNoising Anchor Boxes for End-to-End Object Detection
How about the order management of okcc call center
Pytest multi process / multi thread execution test case
专为决策树打造,新加坡国立大学&清华大学联合提出快速安全的联邦学习新系统
PXE server configuration
Design of short chain
Pinia module division
Common modification commands of Oracle for tables