+ 3
New Challenge [answer with a code] (02)
Just tell me the output of the code. https://code.sololearn.com/c89PKXBkRhp3/?ref=app
10 Respuestas
+ 5
waiting for validation :]
38078
[edit]
i will be waiting to see your own solution for this :)
https://code.sololearn.com/cfAgnENRso4H/?ref=app
+ 7
thanks ^_^
but is this the approach you had in mind for the solution tho?
converting recursive to iterative?
+ 6
Aye it's not about the speed of the language, but of the algorithm! See if you can figure this solution out.
https://code.sololearn.com/cOI9b5cWv1Yz/#py
+ 5
ohh oh i see....
+ 3
Just a different idea.
Since your algorithm adds differences in a mod-7-like cycle, you can convert the bulk to a straight multiply (and add the remainder).
The code below the ##### line generates the lookup table (instead of hardcoding it) and adds a debug explanation...it could all be omitted.
https://code.sololearn.com/c9oezEh8G1P7/?ref=app
+ 2
Please show your optimized code.
EDITED:
this is a requirement.
+ 2
Yes I knew about that aproach.
But I thought that someone would just convert the code to C++.
EDITED:
I thought that the C++ programmers would have advantage in this challenge.
+ 1
Good work @Burey.
+ 1
another challenge:
https://www.sololearn.com/discuss/435877/?ref=app
0
@Schindlabua very good work of optimization. Very good indeed.
You used a lookup table.
EDITED:
I just did not mark your answer as winner because the challenge was for who would get the answer first.