I agree with most of the suggested improvements here. Two things to clarify/change:
When no solution exists it does not make sense to return a nested array - the outcome is an empty set of solutions [], not an empty set containing an empty solution [[]]. This one needs to be changed.
When a single solution exists your improvement definitely is good - a set containing a single solution [[x,y,z]] makes much more sense than the un-nested solution itself [x,y,z]. However, this will invalidate all prior solutions; waiting on feedback from more experienced nerds on this one. I think a backwards compatibility shim would be appropriate.
@trashy_incel: since you already contributed to JS version, could you attempt to disable all other versions except node 18? Currently it throws syntax error for all others.
Yes, in a function signature if we write someFunction(someParam = someValue) we say that someParam has a "default function parameter". That means that if we pass a value to that parameter it gets the passed value, but if we pass nothing then it gets the default value.
function logSomething(param = 'the default value') {
console.log(param);
}
logSomething('a value I passed in');
// a value I passed in
logSomething();
// the default value
These two restrictions I set are to increase the difficulty of kata, this is just to test how you can compress the program to the minimum and your proficiency in the program.
.search uses regex for its' searching. Even if you put a string in it, it'll convert it to regex by using new RegExp(string). So, if the provided arguments are: "hello, world", ".", it'll return 0 because in regex . matches anything.
The same thing happen to me. I think the same solution but give me timeout in the large lists.
This solution is nice, I didn't know about WeakMap
Maybe, maybe not. Maybe it depends on the language as well.
But it's 3kyu now, and after 8 years reranking is probably not gonna happen.
Closing.
I agree with most of the suggested improvements here. Two things to clarify/change:
[]
, not an empty set containing an empty solution[[]]
. This one needs to be changed.[[x,y,z]]
makes much more sense than the un-nested solution itself[x,y,z]
. However, this will invalidate all prior solutions; waiting on feedback from more experienced nerds on this one. I think a backwards compatibility shim would be appropriate.You shoul tell us the concept, because many of us are lost in this kata!
done
This comment is hidden because it contains spoiler information about the solution
English is the default language of the site, so there is no need to specify it. A-Z is enough.
@trashy_incel: since you already contributed to JS version, could you attempt to disable all other versions except node 18? Currently it throws syntax error for all others.
Duplicate issue
done
Yes, in a function signature if we write
someFunction(someParam = someValue)
we say thatsomeParam
has a "default function parameter". That means that if we pass a value to that parameter it gets the passed value, but if we pass nothing then it gets the default value.These two restrictions I set are to increase the difficulty of kata, this is just to test how you can compress the program to the minimum and your proficiency in the program.
This comment is hidden because it contains spoiler information about the solution
.search
uses regex for its' searching. Even if you put a string in it, it'll convert it to regex by usingnew RegExp(string)
. So, if the provided arguments are:"hello, world", "."
, it'll return0
because in regex.
matches anything.