This is a more mathematial problem. A list of numbers L is given, along with one other
numeric parameter, threshold. The problem is to return the smallest positive integer k so that summing the first k inverted items in L is bigger than threshold (or, if no such k can be found, return -1).
An example of this for Python is:
- Code: Select all
>>> M = [0.5, 3.5, 2.0, 7.0, 1.0]
I need help writing a program for this output without using for or while loops!
Please help asap!