Artem H.

asked • 04/25/21

What is Fencepost algorithm? Use it to write a method called countLengths that takes in a String array of 7 elements as parameter& prints the number of characters in each string separated by ",".

Explain "Fencepost algorithm" Use this technique to write a method called countLengths that takes in a String array of 7 elements as parameter& prints the number of

characters in each string separated by ",". For example, if the input to the method is the array 

["The", 'earth", "is", "an'", "inhabited", "endangered", "planet"],

Then it prints the following

3,5,2,2,9,10,6

You do not need to write the entire program, just the method.







1 Expert Answer

By:

Patrick B. answered • 04/25/21

Tutor
4.7 (31)

Math and computer tutor/teacher

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.