Skip to main content

Practice · 1 of 5

substring arithmetic

CHALLENGE
Difficulty: intermediate+25 XP

Implement String firstHalf(String s): the first half, with the extra character going to the second half on odd lengths. Derive the index from the length formula — no loops needed.

Back to lesson: Practice: String lab