create account

RE: Computation Contest #9 [2 SBI] by torsteoe

View this thread on: hive.blogpeakd.comecency.com

Viewing a response to: @quantumdeveloper/computation-contest-9-2-sbi

· @torsteoe ·
I'll share with you a solution that I found in an old exam: 
https://github.com/gravlaks/multiplication-recursive/blob/master/multiplication.py

It's a neat recursive solution, but sadly doesn't solve your problem as big numbers lead to "maximum recursion depth error" and computation is slow.
👍  ,
properties (23)
authortorsteoe
permlinkq3j20y
categoryprogramming
json_metadata{"links":["https://github.com/gravlaks/multiplication-recursive/blob/master/multiplication.py"],"app":"steemit/0.1"}
created2020-01-03 10:48:36
last_update2020-01-03 10:48:36
depth1
children1
last_payout2020-01-10 10:48:36
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length293
author_reputation5,804,783,543
root_title"Computation Contest #9 [2 SBI]"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id93,980,392
net_rshares7,050,781,108
author_curate_reward""
vote details (2)
@quantumdeveloper · (edited)
What you did is just implementing "the intuitive algorithm of simple repeated addition" which I mentioned in the problem which is as you correctly discovered very slow because you need b calls to func1(you could have written there just a+b instead of func1(a,b). Addition is allowed).

You might also want to think about what happens when you use negative numbers.
👍  
properties (23)
authorquantumdeveloper
permlinkq3opmk
categoryprogramming
json_metadata{"app":"steemit/0.1"}
created2020-01-06 12:06:21
last_update2020-01-06 12:08:45
depth2
children0
last_payout2020-01-13 12:06:21
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length364
author_reputation4,456,611,502,865
root_title"Computation Contest #9 [2 SBI]"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id94,092,989
net_rshares506,203,211
author_curate_reward""
vote details (1)