question 1
The method runs on nrrryy. How many characters has it written just after it reads the first y?
the answer, and why
the answer is A
Reading the first r ended n, so 1n. Reading the first y ended rrr, so 3r. 1n3r is 4 characters; yy is written only at the end.
if you chose another
- That is 1n alone. Reading the first y also writes rrr's run, 3r.
- That is the whole code, 1n3r2y. The last run is written only at the end.
- That counts the runs met so far, n, rrr and y. Only runs that have ended are written.