You are viewing a single comment's thread. Return to all comments →
well..wasting memory space???dude space/memory is what you pay for time...if you want your code to give quick and efficient response you use memory rather than cpu computation..also i totally agree i completely miss the stack concept...this is because i want my code to be most efficient and fast..using stack operations like push and pop takes time and cpu (trust me i've sumitted codes using stack that were accurate but it resulted it timeout )...if you're a python programmer timeit my code against yours..i can bet my code will give you quick and efficient result than yours....good day.
Agree..there is always trade-off between time and space
Oh yeah, "simple text editor" is exactly the place to trade time for space - your average "imaginary editor user" requests 100 undos per millisecond and has petabytes of RAM.
Really, guys, some common sense is as important as your readiness to time your python code.
So is the ability to pay attention to the requirements - while there is no explicit requirement to use stacks, the problem still is in "Data Structures > Stacks" category - shouldn't the solution reflect that?
i just want to say..you should respect other's thinking...just like 2+2=4 so does 2+1+1... ^_^ and yes i'm a noob coder,i should have used stacks.
There's absolutely no problem with being noob, neither is with making mistakes etc.
But addressing a stranger by "dude" and "babe" and talking about "respect", hmmm...
Well, to not waste our time any further I will conclude:
I never intended to critisize your code or you personally, just wanted you and those who liked your code to notice that it lacks a certaing something, and to notice that shortness of code is not the absolute virtue, but rather the opposite of it, at least if you're doing commercial, not competitive, programming, where many people will have to read your code and will want to understand it with the smallest effort possible - in most applications "wtf per minute" is much more important than the size of the code.
Good luck to you.
agree..thank you for opening my eyes. ^_^
If they had included a test case in which they appended 1 character 10^6 times (which falls within the problem constraints), you would have had to store around 10^12 bytes (1TB) in memory, far larger than is allowed on here. Apparently they didn't push the test cases to the limit.
That being said, I think your solution is pretty cool, and I would say that it absolutely does use the stack concept.
@erbo_xu you've got a point there,you're absolutely right about memory management,i'll keep that in mind when i solve further problem.