Coming up with a solution that works on the provided test cases - yes, that seems like a 6 kyu problem. Pretty straightforward.
But coming up with a solution that does not time out when running whatever tests happen when you submit - that seems much harder than a 6 kyu problem to me. The obvious solutions to the problem are all probably O(2^n) or maybe O(n!) and so they scale horribly, and apparently there are much bigger input arrays being passed to the tests that run when you submit than the ones you are provided with.
I have the feeling there must be some trick I'm missing here, but even if that's true, this seems like it should not be a 6 kyu kata.
Tips for increasing speed? Right now I am finding all combinations of the initial array and then summing all the items of each combination. I expect finding all the combinations takes too much time but I don't know how I'd do it otherwise without missing anything.
Well maybe do some 8kyus and 7kyu regex. Then, use some sources(Stack Overflow or Geeks for Geeks are both fine). Also, look at different peoples solutions.
Ok I'm very new and I don't under understand regex. I thought I just had to create a function to validate a password based on the requirements. I tried reading the python re page but I didn't quite get it. Could you briefly explain it to me?
You write a regex pattern, like regex = "". Then, using re the author tests if your regex pattern validates the pattern or not. By the way, you don't define a function.
The top of my code says
regex = ""
and then I define my function as
def password(regex)
How do I get the input the author is meaning to give? The test cases all work in my IDE but I output the same answer (false) for the test cases here.
This comment is hidden because it contains spoiler information about the solution
Thank you.
Sort the list first and look at it. You should see a way.
This comment is hidden because it contains spoiler information about the solution
Sort the list first and look at it. You should see a way. It's very simple.
Coming up with a solution that works on the provided test cases - yes, that seems like a 6 kyu problem. Pretty straightforward.
But coming up with a solution that does not time out when running whatever tests happen when you submit - that seems much harder than a 6 kyu problem to me. The obvious solutions to the problem are all probably O(2^n) or maybe O(n!) and so they scale horribly, and apparently there are much bigger input arrays being passed to the tests that run when you submit than the ones you are provided with.
I have the feeling there must be some trick I'm missing here, but even if that's true, this seems like it should not be a 6 kyu kata.
Tips for increasing speed? Right now I am finding all combinations of the initial array and then summing all the items of each combination. I expect finding all the combinations takes too much time but I don't know how I'd do it otherwise without missing anything.
Thanks
Yes, you are missing the "Available since" note in Python docs on
comb
.(Python) AttributeError: module 'math' has no attribute 'comb'
Is there something I'm missing?
A bit unrelated - could the author tell me what he used to make the visualization tool? I've been looking to get into basic visualizations.
Thanks.
Well maybe do some 8kyus and 7kyu regex. Then, use some sources(Stack Overflow or Geeks for Geeks are both fine). Also, look at different peoples solutions.
Ok I'm very new and I don't under understand regex. I thought I just had to create a function to validate a password based on the requirements. I tried reading the python re page but I didn't quite get it. Could you briefly explain it to me?
You write a regex pattern, like
regex = ""
. Then, usingre
the author tests if your regex pattern validates the pattern or not. By the way, you don't define a function.The top of my code says
regex = ""
and then I define my function as
def password(regex)
How do I get the input the author is meaning to give? The test cases all work in my IDE but I output the same answer (false) for the test cases here.
Loading more items...