I started to code it about 2 days ago and i'm stuck. The score of the code i wrote does not match with the score i should expect. I didn't get why since i've followed the description line by line.
I continue to read the description again and again but doubts remains.
According to the description:
"Ogni elemento della sequenza di A viene confrontato con l'elemento corrispondente della sequenza di B" -> that is A - B, which is different from B - A. Then
"se la differenza fra il valore di A e il valore di B è inferiore o uguale ad un parametro k" ... "viene assegnato un punto al concorrente che ha generato il valore più alto"; -> A - B il punto va a max(A,B)
"se la differenza fra il valore di A e il valore di B è superiore a k" ... "viene assegnato un punto al concorrente che ha generato il valore più basso" -> A - B il punto va a min(A,B)
"se la differenza fra il valore di A e il valore di B è" ... " pareggio" -> that is diff=0 "a nessuno"
Than at the end of the game if there is a tie between players
"vince il giocatore che ha generato la sequenza con somma totale dei valori inferiore." -> that is min(SumSequenceOfA, SumSequenceOfB)
We know how it works so i will not stop on all the details comparing letters by letters but just on the points where i have doubts.
- First example, if we compare the first and the second player we should make (A - B) -> (a - c), the difference between the first and the subsequent player. The professor wrote (c - a) and then wrote the difference between (a - c)= -2. that's fine i guess indeed the expected result is the same with the one i have,
- Second example, mine is completely wrong i get [2, 1, 0], but again he wrote (c - a) this time with (c - a) result =2 though and it's different to (a - c)= -2 so the score should go to player 1 not to player 0; between plr0 and plr2 the score should go to plr2, the result is (-2, 0, 2); and between plr1 and plr2 to plr2 again since the result is (0, 2, 2). Expected Leaderboard (0, 2, 1).
Also for the other 2 examples i get (2, 0, 1) and (2, 1, 0) respectively whereas the Expected Leaderboard should be (0, 1, 2) and (1, 2, 0).
Don't know maybe i didn't get something. Do you have suggestions?
checking the other example like ["aaa", "bbb", "ccc", "ddd", "eee"] k=5 and k=3, i get in both (4, 3, 2, 1, 0) as result. of course are subsequent letters (a-b) so it will always be negative, modifing k from 5 to 3 nothing should change, still i don't get why his result is different.
I continue to read the description again and again but doubts remains.
According to the description:
"Ogni elemento della sequenza di A viene confrontato con l'elemento corrispondente della sequenza di B" -> that is A - B, which is different from B - A. Then
"se la differenza fra il valore di A e il valore di B è inferiore o uguale ad un parametro k" ... "viene assegnato un punto al concorrente che ha generato il valore più alto"; -> A - B il punto va a max(A,B)
"se la differenza fra il valore di A e il valore di B è superiore a k" ... "viene assegnato un punto al concorrente che ha generato il valore più basso" -> A - B il punto va a min(A,B)
"se la differenza fra il valore di A e il valore di B è" ... " pareggio" -> that is diff=0 "a nessuno"
Than at the end of the game if there is a tie between players
"vince il giocatore che ha generato la sequenza con somma totale dei valori inferiore." -> that is min(SumSequenceOfA, SumSequenceOfB)
We know how it works so i will not stop on all the details comparing letters by letters but just on the points where i have doubts.
- First example, if we compare the first and the second player we should make (A - B) -> (a - c), the difference between the first and the subsequent player. The professor wrote (c - a) and then wrote the difference between (a - c)= -2. that's fine i guess indeed the expected result is the same with the one i have,
- Second example, mine is completely wrong i get [2, 1, 0], but again he wrote (c - a) this time with (c - a) result =2 though and it's different to (a - c)= -2 so the score should go to player 1 not to player 0; between plr0 and plr2 the score should go to plr2, the result is (-2, 0, 2); and between plr1 and plr2 to plr2 again since the result is (0, 2, 2). Expected Leaderboard (0, 2, 1).
Also for the other 2 examples i get (2, 0, 1) and (2, 1, 0) respectively whereas the Expected Leaderboard should be (0, 1, 2) and (1, 2, 0).
Don't know maybe i didn't get something. Do you have suggestions?
checking the other example like ["aaa", "bbb", "ccc", "ddd", "eee"] k=5 and k=3, i get in both (4, 3, 2, 1, 0) as result. of course are subsequent letters (a-b) so it will always be negative, modifing k from 5 to 3 nothing should change, still i don't get why his result is different.