def URLify(input_string):
    """Replace spaces in input_string with '%20', without using the
    replace() method of Python str objects, and must be done in-place.

    List slicing in Python is O(k), where k is the slice size, so this solution
    could be more optimal.

    Parameters
    ----------
    input_string : str
        String to process

    Returns
    -------
    str
        input_string, with spaces replaces by '%20'
    """
    # Convert to char array
    chars = list(input_string)

    # Get indices of spaces
    space_indices = []
    for i, char in enumerate(chars):
        if char == ' ':
            space_indices.append(i)

    # Extend char array to correct size
    chars.extend([None] * len(space_indices) * 2)

    # Replace spaces with '%20'
    for i, index in enumerate(space_indices):
        adjusted_index = index + (i * 2)  # * 2, since adding 2 chars each loop
        str_end_index = len(input_string) + (i * 2) - 1

        chars[adjusted_index: str_end_index + 2 + 1] = (
            list('%20') + chars[adjusted_index + 1: str_end_index + 1]
        )

    return ''.join(chars)