Java Algorithm interview questions: recursive algorithm question 1, java Recursion

Source: Internet
Author: User

Java Algorithm interview questions: recursive algorithm question 1, java Recursion
Recursive Algorithm Question 1

An integer greater than 0 without loops or local variables. values increase in the order of n, 2n, 4n, and 8n. If the value is greater than 5000, the values are output in the specified order.
Example: n = 1237
The output is:
1237,
2474,
4948,
9896,
9896,
4948,
2474,
1237,

Tip: When writing a program, you should first acknowledge the code in incremental mode. After writing the incremental code, you can add the progressive part.

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.