当前位置:网站首页>Interview question -- output the same characters in two character arrays
Interview question -- output the same characters in two character arrays
2022-07-03 05:12:00 【Jiangnan - crossing the river with a reed】
#include<iostream>
using namespace std;
void FindCommonChar(char a[], int lena, char b[], int lenb)
{
int hasha[256] = {0};
int hashb[256] = {0};
for (int i = 0; i < lena; i++)
{
hasha[(int)a[i]] = 1;
}
for (int j = 0; j < lenb; j++)
{
hashb[(int)b[j]] = 1;
}
for (int i = 0; i < 256; i++)
{
if (hasha[i] == 1 && hashb[i] == 1)
{
std::cout << (char)i << std::endl;;
}
}
}
int main()
{
char a[5] = {'1', 'b', 'C', 'f', 'f'};
char b[6] = {'1', 'b', 'd', 'e', 'C','d'};
FindCommonChar(a, 5, b, 6);
return 0;
}
边栏推荐
- Compile and decompile GCC common instructions
- Notes | numpy-09 Broadcast
- Review the configuration of vscode to develop golang
- 1119 pre- and post order traversals (30 points)
- Detailed explanation of the output end (head) of yolov5 | CSDN creation punch in
- Basic knowledge of reflection (detailed explanation)
- [Yu Yue education] basic reference materials of interchangeability and measurement technology of Zhongyuan Institute of Technology
- Huawei personally ended up developing 5g RF chips, breaking the monopoly of Japan and the United States
- Oracle SQL table data loss
- The programmer resigned and was sentenced to 10 months for deleting the code. JD came home and said that it took 30000 to restore the database. Netizen: This is really a revenge
猜你喜欢
Do you know UVs in modeling?
5-36v input automatic voltage rise and fall PD fast charging scheme drawing 30W low-cost chip
JS dynamic table creation
Online VR model display - 3D visual display solution
Shuttle + alluxio accelerated memory shuffle take-off
[clock 223] [binary tree] [leetcode high frequency]: 102 Sequence traversal of binary tree
Technical analysis of qianyuantong multi card aggregation router
Compile and decompile GCC common instructions
联想R7000显卡的拆卸与安装
BIO、NIO、AIO区别
随机推荐
Keepalived热备与HAProxy
JDBC database operation
Online VR model display - 3D visual display solution
Introduction to deep learning (II) -- univariate linear regression
1086 tree traversals again (25 points)
1110 complete binary tree (25 points)
在PyCharm中配置使用Anaconda环境
Review the configuration of vscode to develop golang
Rust基础入门之(基本类型)
Introduction to deep learning - definition Introduction (I)
What is UUID
ZABBIX monitoring of lamp architecture (3): zabbix+mysql (to be continued)
Appium 1.22. L'Inspecteur appium après la version X doit être installé séparément
sql语句模糊查询遇到的问题
谷歌 | 蛋白序列的深度嵌入和比对
(subplots usage) Matplotlib how to draw multiple subgraphs (axis field)
The programmer resigned and was sentenced to 10 months for deleting the code. JD came home and said that it took 30000 to restore the database. Netizen: This is really a revenge
[Yu Yue education] basic reference materials of interchangeability and measurement technology of Zhongyuan Institute of Technology
音频焦点系列:手写一个demo理解音频焦点与AudioMananger
Source insight garbled code solution