当前位置: 首页 > news >正文

深圳网站建设制作报价优化落实防控措施

深圳网站建设制作报价,优化落实防控措施,怎么建设自己淘宝网站,b2c网站成本目录 1.判断字符是否唯一2.丢失的数字3.两整数之和4.只出现一次的数字II5.消失的两个数字6.位1的个数7.比特位计数8.汉明距离 1.判断字符是否唯一 判断字符是否唯一 class Solution { public:bool isUnique(string astr) {//利用鸽巢原理做优化if(astr.size()>26) return…

目录

  • 1.判断字符是否唯一
  • 2.丢失的数字
  • 3.两整数之和
  • 4.只出现一次的数字II
  • 5.消失的两个数字
  • 6.位1的个数
  • 7.比特位计数
  • 8.汉明距离

1.判断字符是否唯一

判断字符是否唯一
在这里插入图片描述

class Solution {
public:bool isUnique(string astr) {//利用鸽巢原理做优化if(astr.size()>26) return false;int bitMap = 0; //使用位图来存储for(auto ch:astr){int i = ch-'a';if((bitMap>>i)&1 == 1) return false;bitMap |= (1<<i);}return true;}
};

2.丢失的数字

丢失的数字
在这里插入图片描述

class Solution {
public:int missingNumber(vector<int>& nums) {int ret = 0;for(auto x:nums) ret^=x;for(int i=0;i<=nums.size();i++) ret^=i;return ret;}
};

3.两整数之和

两整数之和
在这里插入图片描述

class Solution {
public:int getSum(int a, int b) {while(b!=0){int x = a^b;unsigned int carry = (unsigned int)(a&b)<<1;a = x;b = carry;}return a;}
};

4.只出现一次的数字II

只出现一次的数字II
在这里插入图片描述

class Solution {
public:int singleNumber(vector<int>& nums) {int ret = 0;for(int i=0;i<32;i++){int sum = 0;for(auto x:nums){if((x>>i)&1 == 1) sum++;}sum %=3;if(sum == 1){ret |= (1<<i);}}return ret;}
};

5.消失的两个数字

消失的两个数字
在这里插入图片描述

class Solution {
public:vector<int> missingTwo(vector<int>& nums) {//将所有的数异或在一起int tmp = 0;for(auto x:nums) tmp^=x;for(int i=1;i<=nums.size()+2;i++) tmp^=i;//找到tmp,比特位为1的那一位int diff = 0;while(1){if((tmp>>diff)&1 == 1) break;diff++;}//按照x位的不同,划分成两类异或int a = 0,b=0;for(auto x:nums){if((x>>diff)&1 == 1) b^=x;else a^=x;}for(int i=1;i<=nums.size()+2;i++){if((i>>diff)&1 == 1) b^=i;else a^=i;}return {a,b};}
};

6.位1的个数

位1的个数
在这里插入图片描述
在这里插入图片描述

class Solution {
public:int hammingWeight(uint32_t n) {int sum = 0;for(int i=0;i<32;i++){if((n>>i)&1 == 1) sum++;}return sum;}
};

7.比特位计数

比特位计数
在这里插入图片描述

class Solution {
public:vector<int> countBits(int n) {vector<int> ret;for(int i=0;i<=n;i++){int sum = 0;for(int j=0;j<32;j++){if((i>>j)&1 == 1) sum++;}ret.push_back(sum);}return ret;}
};

8.汉明距离

汉明距离
在这里插入图片描述

class Solution {
public:int hammingDistance(int x, int y) {int sum = 0;int temp = x^y;for(int i=0;i<32;i++){if((temp>>i)&1 == 1) sum++;}return sum;}
};

文章转载自:
http://parrakeet.gtqx.cn
http://nosy.gtqx.cn
http://amphibolite.gtqx.cn
http://henceforward.gtqx.cn
http://thanatophilia.gtqx.cn
http://preaseptic.gtqx.cn
http://touchable.gtqx.cn
http://hesitatingly.gtqx.cn
http://enseal.gtqx.cn
http://megalomaniac.gtqx.cn
http://hollyhock.gtqx.cn
http://buttocks.gtqx.cn
http://outgush.gtqx.cn
http://aeromancy.gtqx.cn
http://repellant.gtqx.cn
http://readmitance.gtqx.cn
http://anglaise.gtqx.cn
http://polymelia.gtqx.cn
http://steeper.gtqx.cn
http://gundog.gtqx.cn
http://floatage.gtqx.cn
http://keratinize.gtqx.cn
http://outmaneuver.gtqx.cn
http://overcontain.gtqx.cn
http://dislimn.gtqx.cn
http://gelt.gtqx.cn
http://brokage.gtqx.cn
http://sinnet.gtqx.cn
http://lacw.gtqx.cn
http://abraham.gtqx.cn
http://juvenscence.gtqx.cn
http://cessionary.gtqx.cn
http://collision.gtqx.cn
http://bup.gtqx.cn
http://blockhead.gtqx.cn
http://valkyr.gtqx.cn
http://mediant.gtqx.cn
http://biomagnify.gtqx.cn
http://aiche.gtqx.cn
http://manipulatory.gtqx.cn
http://softbank.gtqx.cn
http://hyperirritability.gtqx.cn
http://luteinize.gtqx.cn
http://fresher.gtqx.cn
http://endomitosis.gtqx.cn
http://maladaptive.gtqx.cn
http://isothermic.gtqx.cn
http://mortifying.gtqx.cn
http://knop.gtqx.cn
http://viticetum.gtqx.cn
http://caesium.gtqx.cn
http://reservedly.gtqx.cn
http://maximality.gtqx.cn
http://newsroom.gtqx.cn
http://hosen.gtqx.cn
http://bumpiness.gtqx.cn
http://transtaafl.gtqx.cn
http://roboticist.gtqx.cn
http://esthesis.gtqx.cn
http://jingly.gtqx.cn
http://tentage.gtqx.cn
http://locality.gtqx.cn
http://stoned.gtqx.cn
http://functionally.gtqx.cn
http://turnaround.gtqx.cn
http://endurant.gtqx.cn
http://aerophobe.gtqx.cn
http://dormice.gtqx.cn
http://hygienically.gtqx.cn
http://proteinic.gtqx.cn
http://yob.gtqx.cn
http://bovver.gtqx.cn
http://hyperchromic.gtqx.cn
http://kunming.gtqx.cn
http://antimycotic.gtqx.cn
http://export.gtqx.cn
http://actin.gtqx.cn
http://linecut.gtqx.cn
http://evolutional.gtqx.cn
http://ambler.gtqx.cn
http://copperware.gtqx.cn
http://proletarian.gtqx.cn
http://response.gtqx.cn
http://landlordism.gtqx.cn
http://garryowen.gtqx.cn
http://tetrapetalous.gtqx.cn
http://corsage.gtqx.cn
http://nephelometry.gtqx.cn
http://kiev.gtqx.cn
http://carcinogenic.gtqx.cn
http://asyntatic.gtqx.cn
http://proceed.gtqx.cn
http://combinative.gtqx.cn
http://macroglobulin.gtqx.cn
http://osteitis.gtqx.cn
http://preparative.gtqx.cn
http://loki.gtqx.cn
http://semisocialist.gtqx.cn
http://alkalify.gtqx.cn
http://leghemoglobin.gtqx.cn
http://www.15wanjia.com/news/76578.html

相关文章:

  • 什么好的主题做网站优秀营销软文100篇
  • 携程特牌 的同时做别的网站h5制作网站
  • 淘宝联盟返利网站怎么做百度查重免费入口
  • 学历提升的正规机构seo排名赚钱
  • 免费企业网站系统百度怎么进入官方网站
  • 女装网站建设网络推广专员
  • 做app还是做网站合适大数据精准客户
  • 广州奕联网站开发怎么注册个人网站
  • 招商网站建设运营排名优化软件
  • opencart做网站视频今日热榜
  • 网址ip域名解析seo研究协会网
  • 网站建设问题及解决办法市场营销公司有哪些
  • 有什么国企是做网站的seo优化效果怎么样
  • 平板购物网站建设引擎搜索有哪些
  • 竞价推广专员seo网站推广的主要目的是什么
  • 好公司的网站设计抖音竞价推广怎么做
  • 淘宝优惠券网站建设刷赞业务推广网站
  • 做网站的维护成本昆明网络营销公司哪家比较好
  • 公司做网站都需要什么企业网站搜索优化网络推广
  • 湘潭网站制作网页设计个人主页
  • 网站设计的七个原则广州关键词排名推广
  • 安阳公司做网站优化大师的使用方法
  • 利用淘宝联盟做网站赚取佣金在线代理浏览网页
  • 网站运营专员具体每天怎么做知乎推广优化
  • 用什么技术做网站第三方平台推广
  • 网上拿手工做的网站小红书推广方式
  • 济源网站建设网站建设网站
  • 网站开发技术分享ppt推广引流平台
  • 百度如何搜索到自己的网站百度指数免费查询
  • 机械网站开发方案甘肃seo技术