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.
yes not able to pass the testcases in java
reported here as an issue
Java:
List
import)I optimised from passing 30 test cases to 200 test cases in python and am now running out of ideas for optimization. Is it supposed to be more optimised or is the random test case is in infinite loop causing timeout?
In java version I've not passed tests for odd numbers less than zero. For example -3 occured twice or more in arrA and arrB, but this number are not expected in final list.
I've wrote "quickfix" for filtering odd numbers less than zero and pass all test.
In reference solution I've found line like this "i % 2 == 1 : 0 (by odd or even)". But for numbers less than zero we take -1 for odd numbers hence negative numbers are filtered in reference solution.
Maybe I've not understand this task, please check my points.
super logic
Its ok now. Thanks for quick fix!
I've found next tests in random tests suite:
Incorrect answer for board:
Fourth and Fifth lines are started from 1 "106......" and "109......". Thats invalid sudoku board, because we have duplicate value (1) in first column.
Incorrect answer for board:
In first line we have duplicate value (8) (...088...)
And so on.
In Java version I've found next fixed test with unbalanced parenthesis (26 left, 27 right):
(((()()(()(()()()(()()(()()(()))))))(()))()(()()())))
(note 4 closing brackets at the end).Following error message for this test is:
2*(2*(2*(1+1+2*(1+2*(1+1+1+2*(1+1+2*(1+1+2*(1))))))+2*(1))+1+2*(1+1+1))) = 790 ...
(note 3 closing brackets at the end).It should be fixed.
Thank you for the answer!
This comment is hidden because it contains spoiler information about the solution
I understand how it gets the index in string, where is really a second 'c', but how it returns -1 in other cases?
You are absolutely right, it was not working properly for cases where the arrow starts from the beginning of the string. My python solution contained the right version of the operator, but somehow I mistranslated it. Sadly there were no fix tests with an arrow starting at the beginning of the string, so thank you very much for your insight!
I updated the solution, and also added a sample test with string "-->" to cover this case.
In searchArrows method (7th line): while (j > 0 && string.charAt(j) == ...) {
Should be: while (j >= 0 && string.charAt(j) == ...) {
Mine solution pass by luck (after almost 10 attempts), but others cannot solve this kata in Java for this reason (IMO).
In any case, I appreciate your contribution for Java branch. Thanks for all your work!
Lambda Calculus translation
Loading more items...