当前位置:网站首页>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];
}}
边栏推荐
- Google, Baidu and Yahoo are general search engines developed by Chinese companies_ Baidu search engine URL
- Supersocket 1.6 creates a simple socket server with message length in the header
- Wechat applet UploadFile server, wechat applet wx Uploadfile[easy to understand]
- The largest single investment in the history of Dachen was IPO today
- How to find out if the U disk file of the computer reinstallation system is hidden
- STM32 enters and wakes up the stop mode through the serial port
- MIT 6.824 - Raft学生指南
- 2022/2/12 summary
- 2022 PMP project management examination agile knowledge points (9)
- SQL的一种写法,匹配就更新,否则就是插入
猜你喜欢

DAY THREE

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

Asset security issues or constraints on the development of the encryption industry, risk control + compliance has become the key to breaking the platform

37页数字乡村振兴智慧农业整体规划建设方案

互动滑轨屏演示能为企业展厅带来什么

Building lease management system based on SSM framework

Racher integrates LDAP to realize unified account login

Liuyongxin report | microbiome data analysis and science communication (7:30 p.m.)
![[boutique] Pinia Persistence Based on the plug-in Pinia plugin persist](/img/53/95ab85bfd99d943f98881596d0aa8c.png)
[boutique] Pinia Persistence Based on the plug-in Pinia plugin persist

17、 MySQL - high availability + read / write separation + gtid + semi synchronous master-slave replication cluster
随机推荐
Wechat applet UploadFile server, wechat applet wx Uploadfile[easy to understand]
Cas d'essai fonctionnel universel de l'application
vector的使用方法_vector指针如何使用
自动化测试工具Katalon(Web)测试操作说明
System activity monitor ISTAT menus 6.61 (1185) Chinese repair
DAY FIVE
陀螺仪的工作原理
48页数字政府智慧政务一网通办解决方案
(leetcode) sum of two numbers
[CVPR 2022] target detection sota:dino: Detr with improved detecting anchor boxes for end to end object detection
How to use vector_ How to use vector pointer
MySQL主从之多源复制(3主1从)搭建及同步测试
Operation test of function test basis
Common modification commands of Oracle for tables
File and image comparison tool kaleidoscope latest download
沉浸式投影在线下展示中的三大应用特点
DAY SIX
微信小程序uploadfile服务器,微信小程序之wx.uploadFile[通俗易懂]
DAY FOUR
app通用功能測試用例