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)
-1
>>> overflow(M,2.5)
3
>>> overflow(M,2.2)
2


I need help writing a program for this output without using for or while loops!
Please help asap!
THANKS :D
Last edited by stranac on Sat Oct 05, 2013 1:55 pm, edited 1 time in total.
Reason: Added code tags and locked.
carlh
 
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
stranac
 
Posts: 1242
Joined: Thu Feb 07, 2013 3:42 pm

Re: Overflow Sum Problem

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

Join the #python-forum IRC channel on irc.freenode.net!

Please do not PM members regarding questions which are meant to be discussed publicly. The point of the forum is so that others can benefit from it. We don't want to help you over PMs or emails.
User avatar
micseydel
 
Posts: 1488
Joined: Tue Feb 12, 2013 2:18 am
Location: Mountain View, CA


Return to General Coding Help

Who is online

Users browsing this forum: W3C [Linkcheck] and 4 guests