Post Reply 
Programming puzzles: processing lists!
04-20-2017, 02:35 PM (This post was last modified: 04-20-2017 04:10 PM by Han.)
Post: #4
RE: Programming puzzles: processing lists!
(04-20-2017 02:22 PM)pier4r Wrote:  
(04-20-2017 02:21 PM)Han Wrote:  In #4, it is not clear if the resulting list should be expanding in the event that the "addition" causes a carry on the most significant digit. For example, should { 1 1 1 } result in { 1 0 0 0 } or { 0 0 0 } ?

nice catch. {1 0 0 0} I fix it, fixed.

Additional question: should the list be of the exact size as the input if no carry happens? This is important because the lazy approach would simply always return a list whose size is one larger than that of the input.

EDIT: More comments:

#12 and #2 do not seem all that different

#14 could easily run into overflow problems if your list is a minimum of 100 elements; did you mean to return the number as a list of digits in base 10?

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Programming puzzles: processing lists! - Han - 04-20-2017 02:35 PM



User(s) browsing this thread: 4 Guest(s)