I must cry! Programmers who have studied java for 2 years went to interview and hung up on this basic algorithm question!

These are all Java algorithm questions, which should be relatively simple algorithm questions, but I dare say that people who have learned a lot of basic learning or want to go to the interview will not be able to write them completely. Nowadays, most people are learning Java. They are not very solid, and they don't pay much attention to the foundation, so I sent it out for your reference to consolidate the foundation!

 

java algorithm question one:

Enter two positive integers m and n, and find the greatest common divisor and least common multiple.

1. Program analysis: use the elimination method.

Tears ran!  I have studied java for a programmer interview for 1 year and hung up on this basic algorithm question!

java algorithm question two:

Enter a line of characters and count the number of English letters, spaces, numbers, and other characters.

  1. Program analysis: use for loop statement, if conditional statement.

Tears ran!  I have studied java for a programmer interview for 1 year and hung up on this basic algorithm question!

Java algorithm question three:

Find the value of s = a + aa + aaa + aaaa + aa...a, where a is a number. For example, 2 + 22 + 222 + 2222 + 22222 (5 numbers are added together at this time). The addition of several numbers is controlled by the keyboard.

  1. Program analysis: The key is to calculate the value of each item.

Tears ran!  I have studied java for a programmer interview for 1 year and hung up on this basic algorithm question!

Java algorithm question four:

If a number is exactly equal to the sum of its factors, this number is called "final number". For example, 6=1+2+3. Program to find all the completed numbers within 1000.

Tears ran!  I have studied java for a programmer interview for 1 year and hung up on this basic algorithm question!

Java algorithm question five:

A ball falls freely from a height of 100 meters, and rebounds back to half of its original height each time it hits the ground. When it falls again, how many meters does it travel when it hits the ground for the 10th time? How high is the 10th rebound?

Tears ran!  I have studied java for a programmer interview for 1 year and hung up on this basic algorithm question!

Finally, here are some suggestions for programmers:

  1. In fact, algorithms are very important in Java work, but less and less people pay attention to them. I interviewed for a few days earlier, and even the basic bubbling cannot be written correctly. Although it is handwritten, the logic of the program is not complicated. There is not much code. I hope that if you have a partner who is going to interview, you can think clearly and prepare more! 

  2. Stay tuned for more java learning materials!

  3. The topic is over here. Finally, I will share the learning materials that I have organized.

  4. 2020 latest java core knowledge points + big factory interview + java architecture special interview materials + 50 classic java algorithm questions click here or join 1151538097 to receive it for free

1. JAVA core knowledge points

    

2. Big factory interview

 

3. Architecture topic interview

Guess you like

Origin blog.csdn.net/qq_43080036/article/details/108665370