If you look at t, you'll see that there're 4 different types (1, 2, 3, 4) x3 of each, so they should be sorted as following 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4.
If we mark each item of the same type by a letter, we will get (1a, 1b, 1c) and so on, and final sorting should look as following got types: 1a, 2a, 3a, 4a, 1b, 2b, 3b, 4b, 1c, 2c, 3c, 4c.
This comment is hidden because it contains spoiler information about the solution
Hi!
ex: [
{ r: 1, t: 1, i: 1},
{ r: 1, t: 1, i: 2},
{ r: 1, t: 1, i: 3},
{ r: 1, t: 2, i: 4},
{ r: 1, t: 2, i: 5},
{ r: 1, t: 2, i: 6},
{ r: 1, t: 3, i: 7},
{ r: 1, t: 3, i: 8},
{ r: 1, t: 3, i: 9},
{ r: 1, t: 4, i: 10},
{ r: 1, t: 4, i: 11},
{ r: 1, t: 4, i: 12}
]
sorted: [
{ r: 1, t: 1, i: 1 },
{ r: 1, t: 2, i: 4 },
{ r: 1, t: 3, i: 7 },
{ r: 1, t: 4, i: 10 },
{ r: 1, t: 1, i: 2 },
{ r: 1, t: 2, i: 5 },
{ r: 1, t: 3, i: 8 },
{ r: 1, t: 4, i: 11 },
{ r: 1, t: 1, i: 3 },
{ r: 1, t: 2, i: 6 },
{ r: 1, t: 3, i: 9 },
{ r: 1, t: 4, i: 12 }
]
If you look at t, you'll see that there're 4 different types (1, 2, 3, 4) x3 of each, so they should be sorted as following 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4.
If we mark each item of the same type by a letter, we will get (1a, 1b, 1c) and so on, and final sorting should look as following got types: 1a, 2a, 3a, 4a, 1b, 2b, 3b, 4b, 1c, 2c, 3c, 4c.
output: '1:4:7:10:2:5:8:11:3:6:9:12';
Replaced test cases. Thanx a lot! You're great! :)
Fixed that sample test. thanx.
Thank you. Fixed that.
Job's done. :)
Not anymore... ;)
Added way more totally random tests. Have a nice solving :)
Try solving this task in real please, no cheating... :)
Try solving this task in real please, no cheating... :)
Try solving this task in real please, no cheating... :)
Try solving this task in real please, no cheating... :)
Addded some randomness to the tests :)
Sorry, that was very late in night. I was thinking on adding random tests later.
Bunary number can have leading zeroes.
I think you will get timeout on brute force.
Conjure black magic please :)
Sorry, my bad. Fixed that.
Loading more items...