Skip to main content

Practice ยท 1 of 4

Utility library: repeat, clamp, isBlank

Implement three small utilities in one Solution class: 1. static String repeat(String s, int n) โ€” returns s repeated n times (repeat("ab", 3) is "ababab"; n <= 0 gives ""). 2. static int clamp(int v, int min, int max) โ€” v if in range, otherwise the nearest bound. 3. static boolean isBlank(String s) โ€” true for null, empty, or whitespace-only strings.

Difficulty: beginner

Back to lesson: Practice: Practice: Utility Library