Zeros and ones

Report a typo

Given a recursive method:


public static String method(int n) {
    if (n == 0 || n == 1) {
        return String.valueOf(n);
    }
    return method(n / 2) + String.valueOf(n % 2);
}

Assume, n >= 0.

What does the resulting string contain after calling the method?
Select one option from the list
___

Create a free account to access the full topic