def is_inverted(loop_interval: int, time: int, reverse: bool = False) -> bool:
    """Checks if a loop is inverted"""
    if time > loop_interval:
        return is_inverted(loop_interval, time - loop_interval, not reverse)
    else:
        return reverse