当前位置:网站首页>Array of sword finger offer question bank summary (I) (C language version)
Array of sword finger offer question bank summary (I) (C language version)
2022-07-25 20:04:00 【Starlight 125】
List of articles
The finger of the sword offer Question bank summary ( One ) The array of (C Language version )
topic 56: Two numbers that appear only once in the array
- Specific requirements of the topic : An integer array appears only once except for two numbers , The other numbers have all appeared twice . Please write a program to find out these two numbers that only appear once .
- Data range : The length of the array 2≤n≤1000, The size of each number in the array 0 < val ≤1000
- requirement : Spatial complexity O(1), Time complexity O(n)
- Tips : Output in non descending order .
Example 1
Input :[1,4,1,6]
Return value :[4,6]
explain : The smaller number in the returned result comes first - Their thinking :
1. General idea : There is a problem similar to it , It refers to only one number that appears once in the array , The solution is to start from scratch and continue XOR , Because of the same two numbers, the XOR value is 0, So the final XOR result is the answer
2. But this question has two numbers that only appear once a and b, In the end, we can only get a Exclusive or b Value , Just think about it
边栏推荐
- EZDML reverse engineering import database analysis practical operation tutorial
- 笔记——记录一个CannotFindDataSourceException: dynamic-datasource can not find primary datasource问题解决
- 4、Nacos 配置中心源码解析之 服务端启动
- C language learning diary 3 - realloc function
- Skiing mobile H5 game source code download
- 项目中new Promise和async、await中的使用,以及promise.all在项目中的实际应用
- wallys//IPQ5018/IPQ6010/PD-60 802.3AT Input Output 10/100/1000M
- How to set tiktok mobile network environment? How can tiktok break the playback volume?
- 给容器添加3d效果的副标题
- qml 结合 QSqlTableModel 动态加载数据 MVC「建议收藏」
猜你喜欢

PMP每日一练 | 考试不迷路-7.25

Connecting to the database warning establishing SSL connection without server's identity verification is not recommended

03-树1 树的同构

4. Server startup of source code analysis of Nacos configuration center

PyTorch 模型 onnx 文件的导出和调用

参与开源社区还有证书拿?
![[wp]ctfshow-web入门-爆破](/img/4b/6d8f4c044578382b9353d4d1c69c8f.png)
[wp]ctfshow-web入门-爆破

各厂商网络虚拟化的优势

Shopping guide for high-end flagship projectors: dangbei X3 pro and dangbei F5 are more immersive!

Creative drop-down multi choice JS plug-in download
随机推荐
03 isomorphism of tree 1
CarSim simulation quick start (XV) - ADAS sensor objects of CarSim sensor simulation (1)
Socket error Event: 32 Error: 10053. Connection closing...Socket close
The query data returned by the print database is null or the default value. Does not match the value returned by the database
统信UOS下配置安装cocos2dx开发环境
Advantages of network virtualization of various manufacturers
Prescan quick start to master Lesson 19: prescan actuator configuration, track synchronization and non configuration of multiple tracks
Split very long line of words into separate lines of max length
Legal mix of collations for operation 'Union' (bug record)
Rainbond插件扩展:基于Mysql-Exporter监控Mysql
[cloud native | learn kubernetes from scratch] VIII. Namespace resource quotas and labels
VMware virtual machine download, installation and use tutorial
软件设计师下午真题:2009-2022
Js分页插件支持表格、列表、文本、图像
tiktok手机网络环境怎么设置?tiktok怎么破播放量?
[CSAPP Practice Problem 2.32] tsub_ OK (int x, int y) judge whether complement subtraction overflows
各厂商网络虚拟化的优势
When the V100 of mindpole 8 card is trained to 101 epochs, an error of reading data timeout is reported
Shopping guide for high-end flagship projectors: dangbei X3 pro and dangbei F5 are more immersive!
10.< tag-动态规划和子序列, 子数组>lt.53. 最大子数组和 + lt.392. 判断子序列 dbc