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.
Understood, thank you!
Dunno why this is a spoiler...
This comment is hidden because it contains spoiler information about the solution
I did it in 628. Then I realized there were free letters from the get-go. DandDangDang!
So calling two separate where-filters is a logical AND, while combining two where-filters in one where-call is an OR?
// SELECT studentName, teacherName FROM teachers, students WHERE teachers.teacherId = students.tutor AND tutor = 1
query().select(student).from(teachers, students).where(teacherJoin).where(tutor1).execute(); //[{"studentName":"Michael","teacherName":"Peter"}] <- AND filter
// SELECT * FROM number WHERE number < 3 OR number > 4
query().select().from(numbers).where(lessThan3, greaterThan4).execute(); //[1, 2, 5, 7] <- OR filter
Perfect, thanks a lot, @hobovsky, I found the issue.
I was missing the final dot, as the dictionary I loaded for MORSE_CODE didn't include punctuation marks.
My code is not passing the Long messages handling test in TypeScript.
expected:
'THE QUICK BROWN FOX JUMPS OVER THE LA…' to equal
'THE QUICK BROWN FOX JUMPS OVER THE LA…'
This is abbreviated, of course, but when I run the TS file, I receive:
THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG
which seems about correct. What am I missing?
After this kata, you will feel an overwhelming sense of gratitude for having permit to type the letters of the alphabet.
Hats off! I found this one quite challenging!
I am trying to take up this challenge again, but cannot get below 41 lines.
Edit: Finally did it.
Understood. So in my move count this is move 20, and the next move would be Red inserting E3, finishing the line before Yellow can. I guess I know what to fix my implementation then, thank you so much! :-))
And of course you were right that this was no issue, it was an edge case!
I see that by mapping the object with input "colors" of each move to the object with insertion number of each move, so I cannot really log the changing state in my implementation. Also, my number counts all start from 0, including the insertion, so this might mislead if I try to put that into visuals.
Maybe I will double check again if I have any errors in my code, or try to check if there might be more random tests ahead that my function wouldn't pass either currently. I guess I took away too much time from you as well already.
Sure, but you have different data! Maybe my wording was the problem: My input for the function is from the third kata of the basic test, but not the third of the "first round" tests.
The input is as mentioned above, which are all possible 42 moves, so you should not have empty slots.
(console.log([ 'F_Yellow', 'G_Red', 'D_Yellow', 'C_Red', 'A_Yellow', 'A_Red', 'E_Yellow', 'D_Red', 'D_Yellow', 'F_Red', 'B_Yellow', 'E_Red', 'C_Yellow', 'D_Red', 'F_Yellow', 'D_Red', 'D_Yellow', 'F_Red', 'G_Yellow', 'C_Red', 'F_Yellow', 'E_Red', 'A_Yellow', 'A_Red', 'C_Yellow', 'B_Red', 'E_Yellow', 'C_Red', 'E_Yellow', 'G_Red', 'A_Yellow', 'A_Red', 'G_Yellow', 'C_Red', 'B_Yellow', 'E_Red', 'F_Yellow', 'G_Red', 'G_Yellow', 'B_Red', 'B_Yellow', 'B_Red' ].length)
=== 42)
Here is the visualization:
Yellow wins with diagonal from B1 to G6
Red has two "opposing" diagonals:
One from C1 to G6, the other one in the opposing direction from G1 to B6.
You can't see the winner from this visualization, however. The fourth move in all lines is inserted in row 4 (the first row is at the bottom in this graphic). That is why I added the insertion order before.
My bad, I just assumed that if someone passes 205 tests, including all random tests, but fails on a single fixed test, you would sure want to have a look at it without much ado. Will pass more data below for better justification!
I understand that all previous solutions speak for themselves, but I thought people might also have updated the test suite, and could have introduced an error later. Is that not the case?
Below you can see a visualization of the filled board, first with the user handles, then with the order of insertion for each coin. As you can see from the data, Yellow has one winning line, while Red has two. The fourth inserted coin of Yellow's winning line is move no. 20, while Red only inserted his with move no. 21. Yellow wins on move 20, a diagonal.
Data:
User handles:
{
row: [
[
'Y', 'Y', 'R',
'Y', 'Y', 'Y',
'R'
],
[
'R', 'R', 'Y',
'R', 'R', 'R',
'Y'
],
[
'Y', 'Y', 'R',
'Y', 'R', 'Y',
'R'
],
[
'R', 'R', 'Y',
'R', 'Y', 'R',
'Y'
],
[
'Y', 'Y', 'R',
'R', 'Y', 'Y',
'R'
],
[
'R', 'R', 'R',
'Y', 'R', 'Y',
'Y'
]
],
col: [
[ 'Y', 'R', 'Y', 'R', 'Y', 'R' ],
[ 'Y', 'R', 'Y', 'R', 'Y', 'R' ],
[ 'R', 'Y', 'R', 'Y', 'R', 'R' ],
[ 'Y', 'R', 'Y', 'R', 'R', 'Y' ],
[ 'Y', 'R', 'R', 'Y', 'Y', 'R' ],
[ 'Y', 'R', 'Y', 'R', 'Y', 'Y' ],
[ 'R', 'Y', 'R', 'Y', 'R', 'Y' ]
],
diagonalUp: [
[ 'R' ],
[ 'Y', 'R' ],
[ 'R', 'Y', 'R' ],
[ 'Y', 'R', 'R', 'Y' ],
[ 'R', 'Y', 'Y', 'R', 'R' ],
[ 'Y', 'R', 'R', 'R', 'Y', 'Y' ],
[ 'Y', 'Y', 'Y', 'Y', 'Y', 'Y' ],
[ 'R', 'R', 'R', 'R', 'R' ],
[ 'Y', 'R', 'Y', 'Y' ],
[ 'Y', 'R', 'R' ],
[ 'Y', 'Y' ],
[ 'R' ]
],
diagonalDown: [
[ 'Y' ],
[ 'R', 'Y' ],
[ 'Y', 'R', 'R' ],
[ 'R', 'Y', 'Y', 'Y' ],
[ 'Y', 'R', 'R', 'R', 'Y' ],
[ 'R', 'Y', 'Y', 'Y', 'R', 'Y' ],
[ 'R', 'R', 'R', 'R', 'R', 'R' ],
[ 'R', 'R', 'Y', 'Y', 'Y' ],
[ 'Y', 'Y', 'R', 'R' ],
[ 'R', 'Y', 'Y' ],
[ 'Y', 'R' ],
[ 'Y' ]
]
}
Insertion order:
{
row: [
[
4, 10, 3, 2,
6, 0, 1
],
[
5, 25, 12, 7,
11, 9, 18
],
[
22, 34, 19, 8,
21, 14, 29
],
[
23, 39, 24, 13,
26, 17, 32
],
[
30, 40, 27, 15,
28, 20, 37
],
[
31, 41, 33, 16,
35, 36, 38
]
],
col: [
[ 4, 5, 22, 23, 30, 31 ],
[ 10, 25, 34, 39, 40, 41 ],
[ 3, 12, 19, 24, 27, 33 ],
[ 2, 7, 8, 13, 15, 16 ],
[ 6, 11, 21, 26, 28, 35 ],
[ 0, 9, 14, 17, 20, 36 ],
[ 1, 18, 29, 32, 37, 38 ]
],
diagonalUp: [
[ 31 ],
[ 30, 41 ],
[ 23, 40, 33 ],
[ 22, 39, 27, 16 ],
[ 5, 34, 24, 15, 35 ],
[ 4, 25, 19, 13, 28, 36 ],
[ 10, 12, 8, 26, 20, 38 ],
[ 3, 7, 21, 17, 37 ],
[ 2, 11, 14, 32 ],
[ 6, 9, 29 ],
[ 0, 18 ],
[ 1 ]
],
diagonalDown: [
[ 4 ],
[ 5, 10 ],
[ 22, 25, 3 ],
[ 23, 34, 12, 2 ],
[ 30, 39, 19, 7, 6 ],
[ 31, 40, 24, 8, 11, 0 ],
[ 41, 27, 13, 21, 9, 1 ],
[ 33, 15, 26, 14, 18 ],
[ 16, 28, 17, 29 ],
[ 35, 20, 32 ],
[ 36, 37 ],
[ 38 ]
]
}
The third basic test seems odd, is there an error in the test suite data possibly?
Passed in data :
[ 'F_Yellow',
'G_Red',
'D_Yellow',
'C_Red',
'A_Yellow',
'A_Red',
'E_Yellow',
'D_Red',
'D_Yellow',
'F_Red',
'B_Yellow',
'E_Red',
'C_Yellow',
'D_Red',
'F_Yellow',
'D_Red',
'D_Yellow',
'F_Red',
'G_Yellow',
'C_Red',
'F_Yellow',
'E_Red',
'A_Yellow',
'A_Red',
'C_Yellow',
'B_Red',
'E_Yellow',
'C_Red',
'E_Yellow',
'G_Red',
'A_Yellow',
'A_Red',
'G_Yellow',
'C_Red',
'B_Yellow',
'E_Red',
'F_Yellow',
'G_Red',
'G_Yellow',
'B_Red',
'B_Yellow',
'B_Red' ]
According to my function, Yellow's winning move is no. 20, while Red only finishes the line of 4 with move no. 21, so Yellow should have won. However, the test suite expects Red to have won.
My function is passing 205 other tests.
Loading more items...