Php-php Tutorial

Source: Internet
Author: User
For example, there is a string of numbers 1, 2, and 3. the expected result is to give N, such as N2, assign N numbers to each number. after removing their own non-repeated numbers, "2 and 3" is allocated to 1, "3" is allocated to 2, and "1 and 2" is allocated to 3 ", make sure that each number can only be allocated N times... for example, there is a string of numbers 1, 2, 3.
The expected result is to give N, for example, N = 2, and assign N to each number to remove its own non-repeated numbers.
That is, "2, 3" is assigned to 1, "3" is assigned to 2, "1, 2" is assigned to 3, and each number can only be allocated N times.
Because there are many situations that meet the requirements, I only need one of them.
If it is a number 1, 2, 3, 4, then we want N = 2
Then, if the first allocation is 1 corresponding to "2, 3", 2 corresponding to "3", 3 corresponding to "1, 2", then 4 cannot be allocated to the appropriate number. This is not what I need.

To sum up, what should I do if I need to implement such a requirement. Thank you.

Reply content:

For example, there is a string of numbers 1, 2, 3.
The expected result is to give N, for example, N = 2, and assign N to each number to remove its own non-repeated numbers.
That is, "2, 3" is assigned to 1, "3" is assigned to 2, "1, 2" is assigned to 3, and each number can only be allocated N times.
Because there are many situations that meet the requirements, I only need one of them.
If it is a number 1, 2, 3, 4, then we want N = 2
Then, if the first allocation is 1 corresponding to "2, 3", 2 corresponding to "3", 3 corresponding to "1, 2", then 4 cannot be allocated to the appropriate number. This is not what I need.

To sum up, what should I do if I need to implement such a requirement. Thank you.

Problematic question logic
"The expected result is to give N, for example, N = 2, and assign N to each number to remove its own non-repeated numbers"
1, 2, 3. you only need to allocate one to 1, but there are two in your example,
3. it is impossible to allocate three members and remove them.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.