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.
Wow, new method, thanks!
If someone want a link to the documentation about full text search and @@ operator: https://www.postgresql.org/docs/current/textsearch-intro.html#TEXTSEARCH-MATCHING
No problem, you're welcome.
Right, now I can see my mistake, I was thinking exactly oposite(that there is right output is 2x^2).
English is not my native language, so I misunderstanded task)
Thank you for explaining, now I get it)
That means, the derivative of x^2 should be noted as 2x^1 instead of 2x. I think you didn't get that part.
Your code returns 2x^2 instead. That's why it is invalid.
It's from description:
..."^1" should not be truncated when exponent = 2.
Yes, it will pass, but it shouldn't. If it pass it doesn't mean "it's correct".
It passes, why do you say it won't? Have you tried it? Your code is wrong and it passed because random tests didn't generate a test with exponent = 2.
won't pass when exponent = 2
I forgot that method exist, lol.
What does the @@ do? I found it on the internet and I'm not 100% sure why it works.
In order to prevent bugs in more complicated situations like this, you should strive not to learn imperative coding style at all. Almost all languages do that kind of work for you out of the box - in Java it's streams. When you start coding like this, you most certainly will produce bugs.
In this particular case you already produced a bug: what happens if I call this function with an int array of size 0?
I usally do code like this as i learn the language. But i hope to figure out other ways as i learn more of java.
But what do you mean by "dreaded bugs"? It just looks like a simple "brute force" solution to me.
(btw your missing a "do" before your "it" in your finall sentence)
This is neither "clever" nor a "best practice". I always wonder who rates these solutions.
All this is, is straight forward error prone and to be avoided imperative code. Used in production this will eventually lead to all of our dreaded bugs.
DO NOT IT THIS WAY. Never.
Yes, sorting seems to be broken
$numbers | sort
should be identical to$numbers | Sort-Object
.But:
$numbers | sort
sorts numbers as if theese are strings$numbers | Sort-Object
works as expected@Padmanarayanan: Did you print the input to verify the output yourself? I just passed the tests, and it worked ok.
If you still believe there's an issue with the tests, post your code (+ the test input) in reply and mark it as a spoiler.
That's going to be help pin down the issue quickly.
Loading more items...