Viewing a response to: @quantumdeveloper/computation-contest-9-2-sbi
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.
author | torsteoe |
---|---|
permlink | q3j20y |
category | programming |
json_metadata | {"links":["https://github.com/gravlaks/multiplication-recursive/blob/master/multiplication.py"],"app":"steemit/0.1"} |
created | 2020-01-03 10:48:36 |
last_update | 2020-01-03 10:48:36 |
depth | 1 |
children | 1 |
last_payout | 2020-01-10 10:48:36 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 293 |
author_reputation | 5,804,783,543 |
root_title | "Computation Contest #9 [2 SBI]" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 93,980,392 |
net_rshares | 7,050,781,108 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
quantumdeveloper | 0 | 4,977,064,288 | 100% | ||
bootlegbilly | 0 | 2,073,716,820 | 100% |
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.
author | quantumdeveloper |
---|---|
permlink | q3opmk |
category | programming |
json_metadata | {"app":"steemit/0.1"} |
created | 2020-01-06 12:06:21 |
last_update | 2020-01-06 12:08:45 |
depth | 2 |
children | 0 |
last_payout | 2020-01-13 12:06:21 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 364 |
author_reputation | 4,456,611,502,865 |
root_title | "Computation Contest #9 [2 SBI]" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 94,092,989 |
net_rshares | 506,203,211 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
torsteoe | 0 | 506,203,211 | 100% |