2023 Huawei OD machine test real questions Python implementation [full arrangement]

 Table of contents

topic

Ideas

Test points

Code


topic

Given a string S containing only uppercase English letters, you are asked to give the number of all different permutations of S that can be rearranged.

For example: S is ABA, then there are three different arrangements: ABA, AAB, and BAA.

answer requests

Time limit: 5000ms, Memory limit: 100MB

Enter a description.
Enter a string S of no more than 10 characters in length, making sure it is all in uppercase.

Output description:
Output all the different permutation numbers of S rearranged (including itself).

Example 1:
Input
ABA
output
3
Example 2:
Input
ABCDEFGHHA
output
907200

Ideas

1: The problem of total arrangement is essentially a mathematical problem

Test points

1

Guess you like

Origin blog.csdn.net/misayaaaaa/article/details/132942999