[Huawei OD Machine Test Real Questions Python] Alibaba Finds the Golden Treasure Box (II) [2023 Q2 | 100 points]

Preface

"Huawei OD Written Exam Questions python" This column contains the Huawei OD Computer Exam Questions. It will be updated in real time to accept feedback from netizens. It will update you with the latest Huawei Deco OD Exam Questions and provide you with a question bank for learning and practice. You can subscribe to this column Send a private message to the communication group

Title description

[Alibaba Finds the Golden Treasure Chest (II)]

The impoverished woodcutter Alibaba accidentally discovered the treasure trove of a bandit group on his way to cut firewood. The treasure trove contained boxes numbered from 0 to N. Each box was labeled with the number of gold coins hidden in the box
.
Select a number set from the number of gold coins and destroy each box with these numbers.
If half or more boxes can be destroyed, return the minimum size of this number set.

Enter description

A string of numbers, separated by commas, for example: 6,6,6,6,3,3,3,1,1,5.
The number of numbers in the string is an even number, and the number is >= 1. <=100000; each number >=1, <=100000;

Output description

The minimum size of this set of numbers, for example: 2

Example 1 input and output examples are for debugging only, and the background judgment data generally does not contain examples.

enter

 

Guess you like

Origin blog.csdn.net/xiao_pengjy/article/details/131497704