当前位置:网站首页>Sword finger offer 05 (implemented in C language)
Sword finger offer 05 (implemented in C language)
2022-07-04 10:24:00 【sqjddb】
describe
Please implement a function , Replace each space in a string with “%20”. for example , When the string is We Are Happy. The replaced string is We%20Are%20Happy.

char* replaceSpace(char* s ) {
char a[30] = {
0 };
int i = 0;
int length = strlen(s);
while (length--)
{
if (*s != ' ')
{
a[i] = *s;
++i;
s++;
}
else
{
a[i] = '%';
a[i + 1] = '2';
a[i + 2] = '0';
i += 3;
s++;
}
}
return a;
}
边栏推荐
- How can Huawei online match improve the success rate of player matching
- Hands on deep learning (III) -- Torch Operation (sorting out documents in detail)
- Occasional pit compiled by idea
- How to teach yourself to learn programming
- Exercise 9-1 time conversion (15 points)
- 2021-08-10 character pointer
- PHP code audit 3 - system reload vulnerability
- Realsense of d435i, d435, d415, t265_ Matching and installation of viewer environment
- Reprint: summation formula of proportional series and its derivation process
- Talk about scalability
猜你喜欢

Realsense of d435i, d435, d415, t265_ Matching and installation of viewer environment

Some summaries of the third anniversary of joining Ping An in China

Rhcsa day 9

【Day2】 convolutional-neural-networks

leetcode1-3

入职中国平安三周年的一些总结

uniapp 处理过去时间对比现在时间的时间差 如刚刚、几分钟前,几小时前,几个月前

Hands on deep learning (40) -- short and long term memory network (LSTM)

Two way process republication + routing policy

C language pointer interview question - the second bullet
随机推荐
Machine learning -- neural network (IV): BP neural network
Doris / Clickhouse / Hudi, a phased summary in June
BGP advanced experiment
Whether a person is reliable or not, closed loop is very important
View CSDN personal resource download details
DCL statement of MySQL Foundation
Realsense of d435i, d435, d415, t265_ Matching and installation of viewer environment
Batch distribution of SSH keys and batch execution of ansible
Hands on deep learning (41) -- Deep recurrent neural network (deep RNN)
MySQL case
If you don't know these four caching modes, dare you say you understand caching?
Map container
Kotlin set operation summary
Si vous ne connaissez pas ces quatre modes de mise en cache, vous osez dire que vous connaissez la mise en cache?
Button wizard business running learning - commodity quantity, price reminder, judgment Backpack
有老师知道 继承RichSourceFunction自定义读mysql怎么做增量吗?
Introduction to extensible system architecture
如果不知道這4種緩存模式,敢說懂緩存嗎?
OSPF comprehensive experiment
Architecture introduction