This is nicer than just summing the three params since it is generalized to allow for an arbitrary number of parameters. Clever use of spread operator.
I kind of like this approach because I am just taking the input string and checking each char against the vowels string. It's O(n) time complexity with a little space complexity from the vowels string and count variable. The other solution I wrote up is similar to the ones other folks wrote up--using filter(), split() etc. The tradeoff with those seems to be that they create a new array. If the input string is very large, then the space complexity could suffer. Would appreciate thoughts from others.
Scans the array to determine the first and list instance of an element (this is done by comparing the indices). Whenever it matches you have found the unique element.
Same. I wrote up an ugly if..else condition only to realize to see this solution pop up.
This comment is hidden because it contains spoiler information about the solution
This is nicer than just summing the three params since it is generalized to allow for an arbitrary number of parameters. Clever use of spread operator.
Your code fails for cases like
n = 2, m = 2
whereby the correct answer is0
, but your code returnsINVALID
I like this because you wrote a functoin to handle an arbitrary number of scores. The scores dictoinary is a nice addition as well.
Very concise!
I wrote out a long solution but this one is nice.
gracias
estaba perdido
las funciones no las agarra
This comment is hidden because it contains spoiler information about the solution
I kind of like this approach because I am just taking the input string and checking each char against the vowels string. It's O(n) time complexity with a little space complexity from the vowels string and count variable. The other solution I wrote up is similar to the ones other folks wrote up--using filter(), split() etc. The tradeoff with those seems to be that they create a new array. If the input string is very large, then the space complexity could suffer. Would appreciate thoughts from others.
Scans the array to determine the first and list instance of an element (this is done by comparing the indices). Whenever it matches you have found the unique element.
When calculating the population, you're computing a population with a fractional part so you'll need to account for that.
This is 8 kyu in python3 but probably a 7 kyu in Typescript/Javascript.
Very nice.
In TS/JS, there's a tedious and clever way of writing this up.
Loading more items...