当前位置:网站首页>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];
}}
边栏推荐
- File and image comparison tool kaleidoscope latest download
- 【精品】pinia 基于插件pinia-plugin-persist的 持久化
- How can computers ensure data security in the quantum era? The United States announced four alternative encryption algorithms
- What is a responsive object? How to create a responsive object?
- 谷歌百度雅虎都是中国公司开发的通用搜索引擎_百度搜索引擎url
- Compilation of kickstart file
- 2022 PMP project management examination agile knowledge points (9)
- Introduction to GPIO
- PostgreSQL使用Pgpool-II实现读写分离+负载均衡
- Typescript incremental compilation
猜你喜欢

App general function test cases

2022/2/12 summary

MATLIB从excel表中读取数据并画出函数图像

System activity monitor ISTAT menus 6.61 (1185) Chinese repair

专为决策树打造,新加坡国立大学&清华大学联合提出快速安全的联邦学习新系统

Eureka Client启动后就关闭 Unregistering application xxx with eureka with status DOWN

量子时代计算机怎么保证数据安全?美国公布四项备选加密算法

Matplotlib draws a histogram and adds values to the graph

Gradle knowledge generalization

Yaduo Sangu IPO
随机推荐
Huawei mate8 battery price_ Huawei mate8 charges very slowly after replacing the battery
C language input / output stream and file operation [II]
kubernetes部署ldap
2022年PMP项目管理考试敏捷知识点(9)
Design of short chain
Asset security issues or constraints on the development of the encryption industry, risk control + compliance has become the key to breaking the platform
Quickly use various versions of PostgreSQL database in docker
Things like random
微信小程序uploadfile服务器,微信小程序之wx.uploadFile[通俗易懂]
openresty ngx_ Lua subrequest
Devops can help reduce technology debt in ten ways
pinia 模块划分
Personal digestion of DDD
使用yum来安装PostgreSQL13.3数据库
DAY THREE
(leetcode) sum of two numbers
File and image comparison tool kaleidoscope latest download
DevOps可以帮助减少技术债务的十种方式
DAY TWO
STM32通过串口进入和唤醒停止模式