Test your logic thinking and algorithm capabilities for solving problems.

Source: Internet
Author: User

Let's use this simple question to test your logic thinking andAlgorithmCapability. If you can write the implementation algorithm within three hours, congratulations! You have become a master.ProgramPotential capabilities of Members. If you write an algorithm within three days, you can become a cool-man programmer. If it can be written within three weeks, you are a normal programmer's level of thinking. If you haven't written it out for two months, your IQ is not suitable for programmers. Give up early. I can tell you the answer is 10. I have already written a false reference.CodeAnd I will paste it later. Who can write it in Tianya? Please refer to the question:

There are 17 people in a circle (numbered 0 ~ 16) the number of people from 0th starts to report data from 1. All people reporting data to 3 leave the circle and count the number until there is only one person left, what is the original location of this person?

 

 

Just a loop is enough.
List <int> List = new list <int> () {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 };
Int COUNT = 1, curindex = 0;
While (list. Count> 1)
{
If (count ++ % 3 = 0)
List. removeat (curindex );
Else
Curindex ++;
If (curindex> = List. Count)
Curindex = 0;
}
Console. writeline (list [0]. tostring (); http://www.cnblogs.com/tonybinlj/archive/2009/01/04/1367856.html

 

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.