subject

Consider the following recursive method, which is intended to return a String with any consecutive duplicate characters removed. For example, removeDupChars("aabcccd") returns "abcd".public static String removeDupChars(String str){if (str == null || str. length() <= 1){return str;}else if (str. substring(0, 1).equals(str. substring(1, 2))){return removeDupChars(str. substring(1));}else{/* missing code */}}Which of the following can replace /* missing code */ so that removeDupChars works as intended?A. return removeDupChars(str. substring(2));B. return removeDupChars(str. substring(1)) + str. substring(0, 1);C. return removeDupChars(str. substring(2)) + str. substring(1, 2);D. return str. substring(0, 1) + removeDupChars(str. substring(1));E. return str. substring(1, 2) + removeDupChars(str. substring(2));

ansver
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 09:30, nsjcbdhcb
Light travels at a speed of 186,000 miles a second. the distance light travels in a year is 5,865,690,000,000 miles/year 5,865,695,000,000 miles/year 58,656,950,000,000 miles/year 6,789,000,0000 miles/year
Answers: 1
image
Computers and Technology, 23.06.2019 16:30, 19thomasar
How to do this programming flowchart?
Answers: 3
image
Computers and Technology, 23.06.2019 17:30, Artemis3821
Scientists have changed the model of the atom as they have gathered new evidence. one of the atomic models is shown below. what experimental evidence led to the development of this atomic model from the one before it? a few of the positive particles aimed at a gold foil seemed to bounce back. the colors of light emitted from heated atoms had very specific energies. experiments with water vapor showed that elements combine in specific proportions. cathode rays were bent in the same way whenever a magnet was brought near them.
Answers: 2
image
Computers and Technology, 23.06.2019 18:30, sawyerfauver
The computers in the sales department did not have enough data storage capacity to contain all the information the department needed to store, and it was taking a long time for team members to access the data they needed. to fix the problem, the technician installed new, larger hard drives on all the computers.
Answers: 1
You know the right answer?
Consider the following recursive method, which is intended to return a String with any consecutive d...

Questions in other subjects:

Konu
Mathematics, 25.06.2020 08:01
Konu
Mathematics, 25.06.2020 08:01