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.
Expected is error, because there is more than one valid solution, for example:
If I copied everything correctly, you can see how the rows in the middle band are different.
If you are not using specific database functionality then you are using ANSI
name alphabetically sorted test was split yesterday
Thank you for your feedback
I firstly used rank() over (partition by people_id order by sth) and the result was also 1 for all the people, and all tests was positive. Additional tests seems to be necessary
You missed the part where description says
and the name of every people alphabetically
, henceid
row has not the same value of the row_numberThe reason I chose the '4' problem is that it's the shortest in base-10.
Your problem is that 8 isn't the carry, it's the next digit; 0 is the carry.
In multiplying the next digit and adding the carry, the product will always be 1 or 2 digits; the digit in the tens-place is the next carry and the digit in the ones-place is the next digit.
I've worked the first several out below.
All you have left to determine is the stopping criteria and generalizing this algorithm for any number base. This should get you really close without taking the rest of the fun out.
These are interesting links. I'll give a big algorithmic hint that I may later flag as having spoiler content.
Let's take the simplest base-10 problem: the 4-parasitic number ending in 4 is 102564 -- let's pretend we don't know the answer and see if we can figure out how to derive the 10256 part.
If you wrote the problem out starting at the right and worked left:
This means that a number ending in 4 times 4 gives a product that ends in 6, so 6 is the next digit to the left of 4. We also figured out that we have to deal with a 1 carry. Remember that the same set of digits are going to be in the top and the bottom, just shifted and the 4 rotated around to the beginning.
So in the number on the top, write a 6 with the 1 carry over the top to create the next iteration for the multiplication:
So now we know the two digits to the left of the 4 in the multiplicand is 56, with a 2 carry. So expand the next digit out (note the carries across the top)
I'm going to quit spelling the findings out and just write the rest of the iterations out:
The rest is really just a coding this up and accounting for which number-base you're dealing with.
I hope you're feeling engaged not discouraged. This is one of those puzzles that I feel gives a sense of accomplishment after completing it.
There's only a fixed set of answers, so I chose not to show expected values.
I'll give you a couple of hints:
Good luck! Thanks you for your interest.