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.
When
i
is equal toarr.size() - 2
thenj
will becomearr.size() - 1
, but it will not enter the 2nd inner loop due to the condition here -->j < arr.size() - 2
.Also, your code will timeout because its time complexity is O(N^2) whereby an O(N) approach should suffice.
It is already specified how they should be handled in description.
A statement from your code is not a question, closing
This comment is hidden because it contains spoiler information about the solution
First by number of
Best Practice
votes, then by number ofClever
votes, then chronologically ( but in groups of equivalent solutions. comments, newlines and parentheses may be disregarded for grouping ).Issue with your code is not a kata issue, you've run into an infinite loop at somewhere in your code
This comment is hidden because it contains spoiler information about the solution
OP solved it, closing
https://static.wikia.nocookie.net/meme/images/c/c2/HD_Rage_Guy_v2-0.png/revision/latest?cb=20180806134814
Hi
What I undestood is that you stop when the result is between 1 and 9 (included)
But it is not sufficient for me to succeed in passing all the tests ..(minus 1 in comparison with awaited result on several tests)
I guess you're probably trying to access a container's element (string or vector) with an invalid index, but it's hard to say. You can post your code with a spoiler flag in order to get further help, it's hard to help you without knowing your code (Undefined Behaviour gives few informations).
Anyway this is not a kata's issue (I've just solved this kata in C++ with no problem), but a personal question, so I close the issue.
You could also delete the min element if this leads to the requirement
√y ≤ x
earlier. See also DarkD1's commentC++ sample and fixed tests both have
ooooox
as expected.oooooo
does not show up in these tests.Well, you basically just gave a solution away to everyone... so I marked it with a spoiler tag. please be careful, thanks ;)
https://www.geeksforgeeks.org/bitwise-operators-in-c-cpp/
Loading more items...