当前位置:网站首页>[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
边栏推荐
- The Hal library is configured with a general timer Tim to trigger ADC sampling, and then DMA is moved to the memory space.
- Serial communication relay Modbus communication host computer debugging software tool project development case
- 555电路详解
- Study summary of postgraduate entrance examination in July
- Talking about the return format in the log, encapsulation format handling, exception handling
- 基于HPC场景的集群任务调度系统LSF/SGE/Slurm/PBS
- Google colab loads Google drive (Google drive is used in Google colab)
- A small problem of bit field and symbol expansion
- When there are pointer variable members in the custom type, the return value and parameters of the assignment operator overload must be reference types
- 串口通讯继电器-modbus通信上位机调试软件工具项目开发案例
猜你喜欢

Postman interface test V

SQLyog数据库怎么取消自动保存更改

Socket通信原理和实践

Chris Lattner, père de llvm: Pourquoi reconstruire le logiciel d'infrastructure ai

P1223 排队接水/1319:【例6.1】排队接水

STM32基础知识—内存映射

【acwing】789. 数的范围(二分基础)

Pdf document signature Guide

01 use function to approximate cosine function (15 points)

电表远程抄表拉合闸操作命令指令
随机推荐
搭建物联网硬件通信技术几种方案
Appx代码签名指南
根据设备信息进行页面跳转至移动端页面或者PC端页面
Chris Lattner, père de llvm: Pourquoi reconstruire le logiciel d'infrastructure ai
JMeter loop controller and CSV data file settings are used together
Chris LATTNER, the father of llvm: why should we rebuild AI infrastructure software
AHB bus in stm32_ Apb2 bus_ Apb1 bus what are these
OpenGL glLightfv 函数的应用以及光源的相关知识
一文讲解单片机、ARM、MUC、DSP、FPGA、嵌入式错综复杂的关系
Mongodb creates an implicit database as an exercise
宁愿把简单的问题说一百遍,也不把复杂的问题做一遍
High number_ Chapter 1 space analytic geometry and vector algebra_ Quantity product of vectors
Leetcode exercise - 113 Path sum II
Postman interface test IV
ORM model -- associated fields, abstract model classes
Study summary of postgraduate entrance examination in November
5个chrome简单实用的日常开发功能详解,赶快解锁让你提升更多效率!
P1223 排队接水/1319:【例6.1】排队接水
[second on] [jeecgboot] modify paging parameters
ORM model -- creation and query of data records