All problems
Golden Section Reduction Factor
Problem
Golden section search shrinks the bracket by the factor r = (sqrt(5) - 1) / 2 per iteration.
Given the number of iterations, return r raised to that power.
Hint
r is the reciprocal of the golden ratio.
Test cases
case 1
in: [1]
expected: 0.6180339887498949
case 2
in: [5]
expected: 0.09016994374947428
case 3
in: [10]
expected: 0.008130618755783355
Starter codePython
def golden_section_reduction_factor(iterations):
# Your code here
pass3 test cases · run your code against them in the editor