






def 				snake_case__							(							UpperCAmelCase							:  list[list[int]]    ,			UpperCAmelCase							:  int    ,			UpperCAmelCase							:  int    ,			UpperCAmelCase							:  list[int]       ):

    # 1. Validate that path exists between current and next vertices
    if graph[path[curr_ind - 1]][next_ver] == 0:
        return False

    # 2. Validate that next vertex is not already in path
    return not any(vertex == next_ver for vertex in path       )


def 				snake_case__							(							UpperCAmelCase							:  list[list[int]]    ,			UpperCAmelCase							:  list[int]    ,			UpperCAmelCase							:  int       ):

    # Base Case
    if curr_ind == len(UpperCAmelCase       ):
        # return whether path exists between current and starting vertices
        return graph[path[curr_ind - 1]][path[0]] == 1

    # Recursive Step
    for next_ver in range(0    ,			len(UpperCAmelCase       )       ):
        if valid_connection(UpperCAmelCase    ,			UpperCAmelCase    ,			UpperCAmelCase    ,			UpperCAmelCase       ):
            # Insert current vertex  into path as next transition
            lowerCAmelCase__   :Optional[Any]      							=				next_ver
            # Validate created path
            if util_hamilton_cycle(UpperCAmelCase    ,			UpperCAmelCase    ,			curr_ind + 1       ):
                return True
            # Backtrack
            lowerCAmelCase__   :Any      							=				-1
    return False


def 				snake_case__							(							UpperCAmelCase							:  list[list[int]]    ,			UpperCAmelCase							:  int = 0       ):
    lowerCAmelCase__   :Optional[int]      							=				[-1] * (len(UpperCAmelCase       ) + 1)
    # initialize start and end of path with starting index
    lowerCAmelCase__   :Optional[int]      							=				start_index
    # evaluate and if we find answer return path either return empty array
    return path if util_hamilton_cycle(UpperCAmelCase    ,			UpperCAmelCase    ,			1       ) else []











def 				snake_case__							(							UpperCAmelCase							:  float    ,			UpperCAmelCase							:  list[float]       ):
    if discount_rate < 0:
        raise ValueError("Discount rate cannot be negative"       )
    if not cash_flows:
        raise ValueError("Cash flows list cannot be empty"       )
    lowerCAmelCase__   :List[Any]      							=				sum(
        cash_flow / ((1 + discount_rate) ** i) for i, cash_flow in enumerate(UpperCAmelCase       )       )
    return round(UpperCAmelCase    ,			ndigits=2       )


if __name__ == "__main__":
 import doctest

 doctest.testmod()



