博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Single Number II
阅读量:4681 次
发布时间:2019-06-09

本文共 587 字,大约阅读时间需要 1 分钟。

Dscription:

Given an array of integers, every element appears three times except for one. Find that single one.

Note:

Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?

Code:

1    int singleNumber(vector
& nums) { 2 int result = 0; 3 int n = nums.size(); 4 int length = 8*sizeof(int); 5 for (int i = 0; i < length; ++i) 6 { 7 int temp = 0; 8 for (int j = 0; j < n; ++j) 9 {10 if (nums[j] & (1<

 

转载于:https://www.cnblogs.com/happygirl-zjj/p/4592152.html

你可能感兴趣的文章
EventModify
查看>>
mac mysql5.7修改密码
查看>>
C中int8_t、int16_t、int32_t、int64_t、uint8_t、size_t、ssize_t区别
查看>>
sample_code
查看>>
28天成交了104单,多亏了这5个逼单方法
查看>>
Linux常用快捷键和基本命令
查看>>
java
查看>>
[laravel] Laravel - composer install
查看>>
20190218日记
查看>>
python day2 模块初识、pyc定义
查看>>
一道算法作业题(续)
查看>>
Machine Learning From Scratch-从头开始机器学习
查看>>
基础数据结构
查看>>
python url库学习
查看>>
找“水王”
查看>>
Advanced Views and URLconfs(The Definitive Guild to Django)
查看>>
CodeForces 132C 一道简单 dp
查看>>
018-伸展树
查看>>
FPM打包工具
查看>>
JDK版本不兼容问题之:一台机器安装多个版本的JDK
查看>>