Overflow Sum Problem

This is the place for queries that don't fit in any of the other categories.

Overflow Sum Problem

Postby carlh » Fri Oct 04, 2013 7:45 pm

Overflow Sum
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]
>>> overflow(M,10)
>>> overflow(M,2.5)
>>> overflow(M,2.2)

I need help writing a program for this output without using for or while loops!
Please help asap!
Last edited by stranac on Sat Oct 05, 2013 1:55 pm, edited 1 time in total.
Reason: Added code tags and locked.
Posts: 2
Joined: Fri Oct 04, 2013 7:41 pm

Re: Overflow Sum Problem

Postby stranac » Sat Oct 05, 2013 1:59 pm

I have no idea what your question means.
Also, you're expected to post your attempt of solving the problem when asking for help.
And make sure you read the PM I sent you.
Friendship is magic!

R.I.P. Tracy M. You will be missed.
User avatar
Posts: 1790
Joined: Thu Feb 07, 2013 3:42 pm

Re: Overflow Sum Problem

Postby micseydel » Sat Oct 05, 2013 7:35 pm

Due to the reasons discussed here we will be moving to python-forum.io on October 1, 2016.

This forum will be locked down and no one will be able to post/edit/create threads, etc. here from thereafter. Please create an account at the new site to continue discussion.
User avatar
Posts: 3000
Joined: Tue Feb 12, 2013 2:18 am
Location: Mountain View, CA

Return to General Coding Help

Who is online

Users browsing this forum: No registered users and 11 guests