当前位置:网站首页>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;
}
边栏推荐
- What is UUID
- Web APIs exclusivity
- BIO、NIO、AIO区别
- The consumption of Internet of things users is only 76 cents, and the price has become the biggest obstacle to the promotion of 5g industrial interconnection
- [set theory] relationship properties (common relationship properties | relationship properties examples | relationship operation properties)
- 【实战项目】自主web服务器
- [set theory] relation properties (reflexivity | reflexivity theorem | reflexivity | reflexivity theorem | example)
- RT thread flow notes I startup, schedule, thread
- Based on RFC 3986 (unified resource descriptor (URI): general syntax)
- 大学校园IP网络广播-厂家基于校园局域网的大学校园IP广播方案设计指南
猜你喜欢

XML Configuration File

Learn to use the idea breakpoint debugging tool

Cross platform plug-in flutter for displaying local notifications_ local_ notifications

Coordinatorlayout appbarrayout recyclerview item exposure buried point misalignment analysis

Automatic voltage rise and fall 5-40v multi string super capacitor charging chip and solution

联想R7000显卡的拆卸与安装

谷歌 | 蛋白序列的深度嵌入和比对

Basic use of Metasploit penetration testing framework

5-36v input automatic voltage rise and fall PD fast charging scheme drawing 30W low-cost chip
![[set theory] relationship properties (symmetry | symmetry examples | symmetry related theorems | antisymmetry | antisymmetry examples | antisymmetry theorems)](/img/34/d195752992f8955bc2a41b4ce751db.jpg)
[set theory] relationship properties (symmetry | symmetry examples | symmetry related theorems | antisymmetry | antisymmetry examples | antisymmetry theorems)
随机推荐
Introduction to deep learning (II) -- univariate linear regression
[research materials] the fourth quarter report of the survey of Chinese small and micro entrepreneurs in 2021 - Download attached
Automatic voltage rise and fall 5-40v multi string super capacitor charging chip and solution
Analysis of proxy usage of ES6 new feature
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
Rust基础入门之(基本类型)
C language program ideas and several commonly used filters
Class loading mechanism (detailed explanation of the whole process)
【批处理DOS-CMD命令-汇总和小结】-CMD窗口的设置与操作命令-关闭cmd窗口、退出cmd环境(exit、exit /b、goto :eof)
Detailed explanation of yolov5 training own data set
Based on RFC 3986 (unified resource descriptor (URI): general syntax)
[set theory] relation properties (reflexivity | reflexivity theorem | reflexivity | reflexivity theorem | example)
Notes | numpy-08 Advanced index
Redis Introduction et explication des types de données
1099 build a binary search tree (30 points)
SSM framework integration
How to connect the network: Chapter 2 (Part 1): a life cycle of TCP connection | CSDN creation punch in
JS scope
"Hands on deep learning" pytorch edition Chapter II exercise
1094 the largest generation (25 points)