当前位置:网站首页>How will you answer the "Hello world" challenge written in C language?
How will you answer the "Hello world" challenge written in C language?
2022-07-24 03:07:00 【CSDN program life】
In recent days, , Foreign coding platform Intervee Created a simple programming challenge ( Challenge links :https ://platform.intervee.io/get/play_/ch/hello_[w09]orld), Ask for answers print "Hello World", But the code cannot use letters W Or any number .
Although the challenge is for junior developers , But there are still many 2 Developers with more than years of working experience participated in and disclosed the solution .(173 Users tried to solve the problem , share 148 I didn't receive the prompt from the virtual interviewer , The challenge succeeded within the recommended time .)

among , Only 30% The solver of is elementary (0-2 Years of experience ) Developer , meanwhile 85% Those who fail to solve problems on time are also junior developers . This also means that this challenge is difficult for beginners , It sounds like a good way to check whether a candidate is junior or advanced .
Last , The platform selected several interesting results and shared them , Let's have a look !
One 、 The most common and simplest : Use %c specifier
remind :ascii Medium char 87 yes W
printf("Hello %corld", ++*(char[]){"V"});
printf("Hello %corld", *"V" | *"A");
printf("Hello %corld", *"*" + *"-");
char c = c^c++;
c=(c<<(c+c+c+c+c+c))+(c<<(c+c+c+c))+(c<<(c+c))+(c<<c)+c;
printf("Hello %corld",c);
printf("Hello %corld", EUSERS);This is the shortest code ,EUSERS Is, indeed, 87:
https://kernel.googlesource.com/pub/scm/linux/kernel/git/nico/archive/+/v0.97/include/linux/errno.h
Two 、 Cool C++ Solution :
char c = (sizeof(bool)+sizeof(short)) * (sizeof(long) * sizeof(float) - sizeof(char) - sizeof(short));
cout << "Hello " << c << "orld";It is worth mentioning that , The solution is saved as multiple steps , So you can see how the solver does it , Not just his final solution . for instance ( come from : Interway.AI interactive challenges)

3、 ... and 、 Cool Python Solution :
from googletrans import Translator
text = 'Hola Mundo!'
translator = Translator()
print(translator.translate(text).text)
import hello
# _hellol is a known library that prints hello world. Problem solved.Four 、C and C++ Medium “ encryption ” Method :
char str[] = "Obkkh'Phukc\n";
char strPtr = str; while (strPtr != '\n') *strPtr++ ^= '\a';
printf("%s", str);5、 ... and : Same method , stay C++ in :
std::string str = "V_xyz";
char v_x;
for(auto i:str){ v_x=i; break; }
v_x++;
std::cout<<"Hello "<<v_x<<"orld";6、 ... and : Cool cheating scheme :
system("echo \"echo Hello World\" > /usr/bin/gcc");The solver finds the challenge to use /usr/bin/gcc Situated gcc To compile the code , So replace it with “echo Hello World”, Super good !
Last , Do you have any other unique solutions ? Welcome to the challenge !
Link to the original text :10 ways to write Hello World in C - Interway.AI
《 New programmers 001-004》 Fully listed , Welcome to scan the QR code below or click to enter Subscribe now , You can enjoy e-books and exquisite paper books !

边栏推荐
- OSPF routing control
- 水题: 接雨水
- go IO操作-文件读
- Job hunting and recruitment system of SSM part-time job hunting
- Numberoptional: a tool for converting strings to numbers
- Attack and defense world web practice area (weak_auth, simple_php, xff_referer)
- Acwing 4498. pointer (DFS)
- og seo
- 攻防世界WEB练习区(view_source、get_post、robots)
- 在openEuler社区开源的Embedded SIG,来聊聊它的多 OS 混合部署框架
猜你喜欢

CMT 注册——Google Scholar Id,Semantic Scholar Id,和 DBLP Id

Lumberyard game engine of o3de

Relational expression greater than > less than < congruence = = = Nan isnan() logical operator double sense exclamation point!! & |% +-- Short circuit calculation assignment expression shortcut operat

动态规划-01背包问题

Recommendation system topic | recommendation system architecture and single domain cross domain recall model

Ugui source code analysis - Mask

在openEuler社区开源的Embedded SIG,来聊聊它的多 OS 混合部署框架

The next stop of data visualization platform | gifts from domestic open source data visualization datart "super iron powder"
![[management / upgrade] * 02. View the upgrade path * FortiGate firewall](/img/c7/da6db46d372e7462cd14852b662d6d.png)
[management / upgrade] * 02. View the upgrade path * FortiGate firewall

To forge ahead on a new journey, the city chain science and technology carnival was grandly held in Xiamen
随机推荐
The simple use of ADB command combined with monkey is super detailed
Ways to improve the utilization of openeuler resources 01: Introduction
go strconv
攻防世界WEB練習區(view_source、get_post、robots)
go IO操作-文件读
Recommendation system topic | recommendation system architecture and single domain cross domain recall model
go IO操作-文件写
[brother hero July training] day 23: dictionary tree
How to get gait energy map Gei
go log包
Super complete PMP reference document summary
SSM的技术论坛含前后台
O3DE 的Lumberyard 游戏引擎
JVM初始
Attack and defense world web practice area (weak_auth, simple_php, xff_referer)
og seo
322. Change
Nodejs builds cloud native microservice applications based on dapr, a quick start guide from 0 to 1
Numberoptional: a tool for converting strings to numbers
Ugui source code analysis - imaskable