Evaluate a digital algorithm

Source: Internet
Author: User
For example, if I want to split a $ I number into four groups, if this number is 4, the array (0 & amp; gt; 1234 & amp; gt; & amp; gt; 3, 4 & amp; gt; 4) if it is 1, 1 is returned, 2 is returned, or the subscript 1 can start. If this number is 12, the array 0 & amp; is returned; gt; 3, 1 & amp; g... for example, I want to split a $ I number into four groups.
If this number is 4, the array of 1 2 3 4 is returned (0 => 3, 4 => 4)
If it is 1, 1 is returned, 2 is returned, or both can start with subscript 1.

For example, if this number is 12, the returned array 0 => 3, 1 => 6, 2 => 9, 3 => 12, or subscript 1 can start.
For example, if the number is 8, the returned array is 2, 4, 6, and 8.
If the value is greater than or equal to 4, four arrays are returned, and there are multiples of certain numbers.
The last array must return this number $ I

I think it's so difficult ^

Reply content:

For example, I want to split a $ I number into four groups.
If this number is 4, the array of 1 2 3 4 is returned (0 => 3, 4 => 4)
If it is 1, 1 is returned, 2 is returned, or both can start with subscript 1.

For example, if this number is 12, the returned array 0 => 3, 1 => 6, 2 => 9, 3 => 12, or subscript 1 can start.
For example, if the number is 8, the returned array is 2, 4, 6, and 8.
If the value is greater than or equal to 4, four arrays are returned, and there are multiples of certain numbers.
The last array must return this number $ I

I think it's so difficult ^

It's better to give a number range. What you're talking about is too ambiguous.
If the number is 2, 1 2 is returned.
If the number is 4, 1 2 3 4 is returned.
Returns 3 6 9 12 if the number is 12.
Returns 2 4 6 8 if the number is 8.
This number must be the last one.

What if it is an odd number? Is this regular?

You are not clear about this question,There is a multiple of a certain number Interval
What does this mean?

What you describe is an implementation principle. What if your implementation principle is wrong? Are there no initial business logic requirements? For example, how to implement a product release? Is it possible to stick hot posts? And so on.

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.