Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Take some more time and implement a relatively efficient algorithm.
This comment is hidden because it contains spoiler information about the solution
(Python, sorry~)
And correct! Stupid of me, but yes I had given the function a third (thought defaulted) input (ans=[]), because I recursed and needed to pass on my accumulating list of squares. Must have screwed up the testing apparatus?
Code could be less clunky, but it works and is submitted now. Ended up just pasting everything in a helper function so I could keep that logic. Will have to fine-tune later.
Thanks!
My guess is you're using a global var that keeps its value when your function is called more than once.
It's a good idea to tell which programming language you are using.
My first guess is you are modifying the arguments given.
Issue: my code runs and outputs the exact array as Expected. HOWEVER... in the tests console, I pass test #1, but then for each subsequent test, my output answer is my actual/the real answer (again, tested in Atom and PythonTutor.com) BUT with the previous answer stacked on top of it!
Here is my final console print for each test-- as you can see, each is 'stacked' with the previous test's answer PLUS this test's answer.
SOLUTION!: [3, 2, 1, 1]
SOLUTION!: [3, 2, 1, 1, 3, 2, 1, 1]
SOLUTION!: [3, 2, 1, 1, 3, 2, 1, 1, 14, 6, 6, 2, 2, 2]
(and it continues this indefinitely...)
This issue does not happen in Atom or any other program that I run. Is this a bug on your side? Or is could there be a small error in my code? (though I don't know how my code could save a previous test's answer!!!)
This comment is hidden because it contains spoiler information about the solution