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.
I just finished the kata and yes the largest number is smaller than 4000, as it would not be possible to build it with the given rules
What's the largest number to convert? is it in the range(1, 4000)? Because for larger numbers "M" is not sufficient...
In my opinion it should be added to the description that the stack starts with an initial element 0. However, that is easy to figure out. IMO it should say in the description that the in-/decrement operations are to be performed on the top element.
@mingzhou thank you very much for the explanation, this helped me to understand it :)
I have the same issue with python. I am guessing there has to be a way to not run into precision issues.
This comment is hidden because it contains spoiler information about the solution
I feel like I am not getting something. According to wikipedia a 4-connected pixel is:
4-connected pixels are neighbors to every pixel that touches one of their edges. These pixels are connected horizontally and vertically. In terms of pixel coordinates, every pixel that has the coordinates (x+-1, y) or (x, y+-1) is connected to the pixel at (x, y).
So the way I am understanding it, that a pixel at (x, y) is 4-connected where all neighbors [(x+1, y), (x-1, y), (x, y+1), (x, y-1)] are white (in this case). In the example I can only see one of those. I replaced it with an x:
I am pretty sure I am misunderstanding what is meant. Any help is highly appreciated.
Oh, ups.. I didn't know it is not possible to submit in that case...
This comment is hidden because it contains spoiler information about the solution
There is an error in the Test-cases in the python translation.
When I attempt to test my solution I get following error:
Traceback (most recent call last):
File "main.py", line 51, in
p = random.choice('123456789') + ''.join([random.choice('0123456789') for char in range(len_of_random)])
File "/usr/local/lib/python2.7/random.py", line 277, in choice
return seq[int(self.random() * len(seq))] # raises IndexError if seq is empty
NameError: global name 'int' is not defined
Therefore in generating the random tests 'int' was used, which was Disabled by default...... This only occurs in python 2.7
Am I the only one who thought this is way too difficult for 7kyu??
Could someone explain to me, why this solution works? I was looking for a smart way on how to choose which number to pick, but I could not come up with one. So instead I used memoization. But I can's seem to understand what the rule is here and why it works. Could someone elaborate on it?
Thanks in advance :)
Thanks, for the heads up. I rewrote my code and got it to pass :)
I am running in a failed test/an error when executing this code: 'ssstnssstsnsssttntnstnsnntnsttnstnssnnnn'
It is the third test in 'Testing conditional and unconditional jump functionality':
Here is how I interpret the code so far:
(ss stn) (ss stsn) (ss sttn) (tn st) (n sn n) tnsttnstnssnnnn
ss add stn to stack (1)
ss add stsn to stack (2)
ss add sttn to stack (3)
tn st pop 3 from stack adding to out out = 3
n sn jump unconcitionally to label n (label='') but the label is not defined yet.. so what do I do??
The options I thought about:
Expect the next few characters to be a number -> results in an infinite loop
call whitespace with the remaining code to use the output as a position for the label '' to jump to -> results in an error
call FlowControl as I expect the next few caracters to declare the label with the remaining code -> no labels are declared
call FlowControl as I expect the next few caracters to declare the label with 'ss'+code -> declares label 't' not '' as expected
I am running out of ideas.. How am I supposed to interpret this?
Any help is highly appreciated :)
I just had another thought I am basically compiling on the fly... Do I have to evaluate the code first and do everything (so executing the functions) afterwards? So basically a label could be declared at any point in the code?
This comment is hidden because it contains spoiler information about the solution
Loading more items...