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.
I am passing the sample test case, but failing when I attempt to solve this challenge.
I'd suggest that a more robust sample test case is added, that factors in things like having to crop around the living cells.
Even having the output of the attempt be a 2D array of 1's and 0's would be much better than the current html-ized version. It is needlessly cumbersome to count and type in the test arrays by hand.
If I am missing something, do correct me.
Hints:
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Avanta, thanks a ton for the help. I did a complete re-write of my code, and stored key-value pairs in a dictionary that stays persistent across my for loops.
So now, I've gotten the code to work with all my test cases. However, when I actually go for an attempt, once again codewars times out... I'm assuming the Assessment uses humongous numbers that my dictionary is having a hard time managing. I'll post my code below.
EDIT: It runs and completes huge numbers (like 5978013048845973136) on my computer, but slowly.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Will do, thanks for the suggestion!
From what you've said, that sounds like it should be fast enough.
Maybe post your code below with a spoiler tag?
I'm new to all of this. I got an algorithm working on my local machine in Python, but it constantly fails on codewars as having timed out. Does this mean I need to use some algebra tricks to make this faster?
In it's current state, I defined a function that does the calculations to find a given pile of cubes based on a value for n. It then brute forces through every value, starting at 1. I'm guessing this is total amateur hour, but how do I go about doing this differently? Algebra?