当前位置:网站首页>[detailed explanation of Huawei machine test] tall and short people queue up
[detailed explanation of Huawei machine test] tall and short people queue up
2022-07-07 10:25:00 【A less intelligent programmer】
List of articles
Preface
《 Detailed explanation of Huawei's machine test questions Python Realization 》 The column includes Huawei column of niuke.com 、 Huawei test questions 、 Huawei OD Real problem of machine test .
If you are preparing for Huawei's interview , If you want to know something, you can send me a private letter , I will try my best to help you , I can also give you some suggestions !
This paper solves the non optimal solution ( Non optimal performance ).
Title Description
Now there is a group of children , They are different in height , We express the height of this group of children in an array of positive integers , Such as arrays {5,3,1,2,3}.
Now we want the children to line up , With “ high ”“ Short ”“ high ”“ Short ” Sequential arrangement , every last “ high ” The position of the children should be higher than the adjacent position or equal ; every last “ Short ” The children in the position should be shorter than or equal to the adjacent position ;
Ask the children to move at a minimum distance , The first one from “ high ” Start to line up , Output the minimum moving distance .
for example , In the demonstration team {5,3,1,2,3} in ,{5, 1, 3, 2, 3} It's the sorting result .{5, 2, 3, 1, 3} Although also satisfied “ high ”“ Short ”“ high ”“ Short ” Sequential arrangement , But children move a lot , So it's not the best result .
The definition of moving distance is as follows :
The second child moves behind the third child
边栏推荐
- 01 use function to approximate cosine function (15 points)
- Programming features of ISP, IAP, ICP, JTAG and SWD
- 反射效率为什么低?
- 浅谈日志中的返回格式封装格式处理,异常处理
- Differences between MCU and MPU
- The request object parses the request body and request header parameters
- Pdf document signature Guide
- Postman interface test VI
- JMeter about setting thread group and time
- . Net configuration system
猜你喜欢
Chris Lattner, père de llvm: Pourquoi reconstruire le logiciel d'infrastructure ai
Vs code specifies the extension installation location
ORM model -- associated fields, abstract model classes
555电路详解
Appx code signing Guide
1323:【例6.5】活动选择
Methods of adding centerlines and centerlines in SolidWorks drawings
求最大公约数与最小公倍数(C语言)
The variables or functions declared in the header file cannot be recognized after importing other people's projects and adding the header file
Postman interface test IV
随机推荐
5个chrome简单实用的日常开发功能详解,赶快解锁让你提升更多效率!
学习记录——高精度加法和乘法
Weekly recommended short videos: what are the functions of L2 that we often use in daily life?
XML configuration file parsing and modeling
ORM -- grouping query, aggregation query, query set queryset object properties
【二开】【JeecgBoot】修改分页参数
Factorial implementation of large integer classes
Kotlin实现微信界面切换(Fragment练习)
SolidWorks工程图中添加中心线和中心符号线的办法
Postman interface test VI
Sword finger offer 38 Arrangement of strings [no description written]
ORM model -- creation and query of data records
The variables or functions declared in the header file cannot be recognized after importing other people's projects and adding the header file
Smart city construction based on GIS 3D visualization technology
This article explains the complex relationship between MCU, arm, muc, DSP, FPGA and embedded system
@Transcation的配置,使用,原理注意事项:
ISP、IAP、ICP、JTAG、SWD的编程特点
BigDecimal value comparison
每周推荐短视频:L2级有哪些我们日常中经常会用到的功能?
STM32基础知识—内存映射