135201
You will be muted until you read the rules. Read them! @Rules_for_Python A group about the Python programming language. Offtopic things go here: @pythonofftopic Resources to learn python: @pythonres Group for Hy: @hylang Selenium: @SeleniumPython
But that formula got the right answer for n = 1 - 4😭
Читать полностью…
Can you find the syntax to increase allowed execution time and apply it
Читать полностью…
this is known as tabulation btw. (alternative to memorization with recursion)
Читать полностью…
can you give some samples for me to validate the output I generated.
Читать полностью…
how about you use for loop to replace recursion instead
Читать полностью…
yes, u right. im sorry for misinterpreted. but what i get is this one 'Execution Timed Out (12000 ms)'
Читать полностью…
Oh i see. sorry, maybe I misinterpreted. What I mean by wrong output is that it does not provide a correct and appropriate solution to what the case provider requested😁
Читать полностью…
but with all due respect, I appreciate what I just learned from your response
Читать полностью…
the code that i gave its right but i need to make that code is effective. I mean like its more faster ya with memo or using loop its get the right answer and there's nothing wrong with that. But i want to ask in this group especially ask to u can u gave me more effective than memo or using loops? That's my point bro
Читать полностью…
i try with mathematics way with this formula 3(n² - 1) + 3n
Читать полностью…
def find_x(n):Читать полностью…
if n == 0: return 0
table = [0] * (n + 1)
for i in range(1, n + 1):
table[i] = table[i - 1] + 3 * i
for j in range(1, i):
table[i] += table[j - 1] + 3 * j
return table[n]
Sounds like does not produce the correct output, which means the code is wrong.
Читать полностью…
You need to be careful with what you say. When the code produces the correct output but isn't fast enough, it isn't wrong. It just not satisfies the requirements. If it produces the wrong output, it's wrong.
Читать полностью…
There's nothing wrong with asking whether it's possible here to know how to get the mathematical formula wisely or what? who knows?
Читать полностью…
I give you another example:
Here is wrong code. I need a formula from it to make it faster. Oh, and it's wrong code. It produces the wrong result. How could you possibly answer that?