5 kyu
Sort - one, three, two
839 of 2,279dinglemouse
Loading description...
Sorting
Strings
Algorithms
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
In Javascript version I have differecies with answer, for example I have 203, 236, but right answer is 236, 203, although sort in Js gives that answer.
Is this a question, or an issue, or an observation, or what?
FYI - For the purpose of this Kata 203 comes after 236 because "zero" comes after "three".
python new test frame work
Approved
Done!
The C version still gives "Array Wrong", with the expected array, but without the actual value. Just printing arrays always in my code gives clobbered output, why not add it to the test code?
Fixed
The code was working on an online C++ compiler, however I got a ' const qualifier was dropped ', does anyone have any particular idea regarding this ? Thanks
[ 'eight hundred and eight', 'fifty four', 'four hundred and fifteen', 'fourty eight', 'nine hundred and seventy seven', 'one hundred and twenty six', 'six hundred and fifty seven', 'three hundred and eight', 'three hundred and seventy one', 'two hundred and thirty five' ] expected [ 808, 54, 415, 48, 977, 126, 657, 308, 371, 235 ] to deeply equal [ 808, 54, 48, 415, 977, 126, 657, 308, 371, 235 ]
can yo tell me what's wrong with my solution..I am not able to understand it from here..My solution seems ok for me and it is in alphabetical order. but in the ans 48 and 415 are switched...
Not an issue. Your spelling is wrong. 40 is "forty", not "fourty".
It was fun but hart :D I'd say it would better fit in the 4kyu section :)
Hello, everyone! I am new to codewars and python programming, please help me with this Are we not supposed to use packages and tackle the problem? I get a module not found error whenever i try to import a package. Thank You Never mind passed the test without using package.
I so just wanted there to be a solution where someone just typed out an entire dictionary of the numbers.
This comment has been hidden.
I suggest adding correct spelling of hundreds and tens in Notes section.
I'm passing 101 and failing 5. The biggest error is that fourty four comes before four hundred fourty five. Any advice?
Nevermind! I got it.
Great Kata, thanks!
Sure, my advice is learn to spell.
Thanks for the great Kata dinglemouse!
:-)
In javascript, I have no idea how to fix the issue: "eighteen" comes before "eight hundred fifty six" and "eight hundred twenty five" any help? thanks!
ASCII
' '
< ASCII'e'
yes, i understand that, but i don't see the fix.
This comment has been hidden.
This comment has been hidden.
Doing the C-version.
It's extremely non-helpful both doing sample test or attempt.
It has one error-response - which is "Array is wrong."
There is no indication whatsover what is expected, and no specification of what the numbers are supposed to look like.
So.. what is a number like 805 supposed to look like ?
"eight hundred five" or "eight hundred and five" ?
if it's "eight hundre and five" should 851 then be "eight hundred and fifty one" or "eight hundred fifty one"?
This portion of your issue irrlevant because the "and" or (lack of "and") won't affect the sort order.
See other discourse comments below where other people had similar questions
I see you and some others say it's irrelevant.
"eight hundred five" and "eight hundred fifty one" - which gives 851 before 805 "eight hundred and five" and "eight hundred fifty one" gives 805 before 851. "eight hundred and five" and "eight hundred and fifty one" gives 851 before 805.
When I said won't affect the sort order, I meant only when applied consistently
e.g. "and"
If you inconsistently use extra words based on your own set of rules then of course it can mess up the sort order.
Maybe that's why people have been asking for the formatting rules?
You did update the description, but the main issue remains.
The only error-response is '''"Array is wrong."'''
When attempting to solve this you don't get to see the expected order like you do in e.g. Java.
Really? I thought I fixed that for
C
yesterday.(I only output "expected" when array is wrong, not always).
I think that before you post this kata, you should learn a lot: This kata sorts an int array: This kata tests this array {4, 1, 3, 2}! My result is {1,2,3,4} Error: arrays first differed at element [0]; expected:<4> but was:<1>
So do you want to sort or to sh** this array
So bad programmer :( :(
Not an issue, read the description:
So, four -> one -> three -> two is right.
Sigh. Very tired now of "issues" like this.
Kata description has been updated with example for those who require spoon-feeding.
While this seems to be poorly named because it's more fun, there should be SOME indication in the description that named numbers have no hyphens, and there should be no "and"s.
OK. I will update the description if you give an example where it makes any difference:
one hundred one
,one hundred two
is same order asone hundred and one
,one hundred and two
ninety eight
,ninety nine
is same order asninety-eight
,ninety-nine
Fair enough, I guess that's why it's bounded at 999. Very clever, Mouse!
The descriprion of this kata has issues.....
I used an annoying amount of time figuring out 40 is "forty", not "fourty"...
Same here. Could use some clarification in the description.
Clarify what? There is no ambiguity. Forty is the ONLY correct spelling of the word, and has been since 1700's!
Ref: https://www.merriam-webster.com/words-at-play/is-it-forty-or-fourty
Haha, dinglemouse's reply is on point :D hahaha
Thanks a lot. Your comment helped me :)
Aren't there multiple ways to express numbers using words? E.g "nine hundred ninety nine", or "nine hundred and ninety nine", or "nine hundred and ninety-nine". Do we ned to use a specific format to pass the tests?
Use spaces and words for numbers only. Not expecting any "and", or "-" or anything else you might think of.
Your example with/without "and" will have same sort order anyway though (if consistently applied)
C# Translation added.Please review and approve~
Approved :-)
i try to solve it in c can you give me some hints please? i pass bigger and duplicats and fail the rest(all, empty, random, smaller, zero)
For help to solve Kata please see https://gitter.im/Codewars/codewars.com/kata-solving-help
discription makes me cringe xd
So no num2words? What coulld be a better answer than use a library?
This comment has been hidden.
Why do you think that?
For me, I don't count the spaces between eight and hundred, so I compare character "e" in 18 and "h" in 800
Thank you so much, I have solved my problems, its because I dont count the spaces between numbers
@ButcherZ
expected
is the expected result. The clue is in the name.I checked other comments, in fact I understood the subject all wrong! thanks for your replying, I deleted what I posted before. xD
Interesting kata. It's helped me to recall work with string compare
nice kata! was a fun one to tackle.
The solution sorts the numbers 804, 844 and 846 as follows:
[844, 846, 804]
. My solution sorts it as:[804, 844, 846]
under the following spelling (which as far as I can see is correct):['eight hundred four', 'eight hundred fourty-four', 'eight hundred fourty-six']
What spelling is used in the example? I use the following examples:
https://www.grammarbook.com/numbers/numbers.asp
https://www.ego4u.com/en/cram-up/vocabulary/numbers/generator (American English)
not an issue, your spelling is incorrect:
forty
(as you can actually see in the links you provided... :p )Ah, thank you. Not a native speaker
I am a native speaker, and I made the same mistake!
I am really confused about this Kata, how to sort the numbers ?
;)
Can you explain more than just repeating what is asked? What does name mean?
@Blind4Basics How can i change numbers to words using python? Pls help.
1000 is too low :-/
My solution only passed the tests with "eightteen" instead of "eighteen" (javascript version)
except that absolutely nothing can be done about that, considering the task to achieve. There are no two numbers built on
eight
that would lead to different order usingeightteen
instead ofeighteen
.It makes a difference in this case "eight", "eight(t)een", "eighthundred"
EDIT: I see English uses a space between eight and eight hundred
No, because of the lexicographic sorting:
nothing to do about it, just by checking the order.
I had the same annoying issue.
There is no issue.
I believe there might be a bug:
Expected: '[856, 825, 18, 129, 717, 771, 78, 29, 217, 266]', instead got: '[18, 856, 825, 129, 717, 771, 78, 29, 217, 266]'
"eighteen" comes before "eight hundred fifty six" and "eight hundred twenty five", or am I missing something?
PS @dinglemouse this is for the JavaScript version.
Because ASCII for
" "
comes before ASCII for"e"
.Oh right, thanks:!
Python translation available :)
I added a note in the description about number as a string formatting, could you verify if it's correct for all versions of the kata?
Translation approved. Description change rejected.
for C++ it is says expected for all numbers is expected: [ 8, 800, 808, 818, 880, 888, 885, 884, 889, 881, 887, 886, 883, 882, 809, 811,
I can't see how eight hundred nine is less than eight hundred eleven
Yes, it is a bug.
811
should be next after882
@clcraig
- please fix your C++ translation.Sorry about that. It's fixed now.
Looks like it still has 809, 811
@clcraig
- fixed how/where? I saw no revision changes anywhere.@108Shiva, the C++ translation should work now. Apologies, I'm new to creating Katas/Kumites and still learning the interface. :)
Thanks. It works now.
@dinglemouse, C++ translation ready for review.
Approved. Thanks :-)
In this test:
assertArrayEquals(new int[]{8, 18, 800, 808, 818, 880, 888, 885, 884, 889, 881, 887, 886, 883, 882, 811, 815, 850, 858, 855, 854, 859, 851, 857, 856, 853, 852, 805, 840, 848, 845, 844, 849, 841, 847, 846, 843, 842, 804, 814, 809, 819, 890, 898, 895, 894, 899, 891, 897, 896, 893, 892, 801, 807, 817, 870, 878, 875, 874, 879, 871, 877, 876, 873, 872, 806, 816, 860, 868, 865, 864, 869, 861, 867, 866, 863, 862, 810, 813, 830, 838, 835, 834, 839, 831, 837, 836, 833, 832, 803, 812, 820, 828, 825, 824, 829, 821, 827, 826, 823, 822, 802, 80, 88, 85, 84, 89, 81, 87, 86, 83, 82, 11, 15, 50, 58, 55, 54, 59, 51, 57, 56, 53, 52, 5, 500, 508, 518, 580, 588, 585, 584, 589, 581, 587, 586, 583, 582, 511, 515, 550, 558, 555, 554, 559, 551, 557, 556, 553, 552, 505, 540, 548, 545, 544, 549, 541, 547, 546, 543, 542, 504, 514, 509, 519, 590, 598, 595, 594, 599, 591, 597, 596, 593, 592, 501, 507, 517, 570, 578, 575, 574, 579, 571, 577, 576, 573, 572, 506, 516, 560, 568, 565, 564, 569, 561, 567, 566, 563, 562, 510, 513, 530, 538, 535, 534, 539, 531, 537, 536, 533, 532, 503, 512, 520, 528, 525, 524, 529, 521, 527, 526, 523, 522, 502, 40, 48, 45, 44, 49, 41, 47, 46, 43, 42, 4, 400, 408, 418, 480, 488, 485, 484, 489, 481, 487, 486, 483, 482, 411, 415, 450, 458, 455, 454, 459, 451, 457, 456, 453, 452, 405, 440, 448, 445, 444, 449, 441, 447, 446, 443, 442, 404, 414, 409, 419, 490, 498, 495, 494, 499, 491, 497, 496, 493, 492, 401, 407, 417, 470, 478, 475, 474, 479, 471, 477, 476, 473, 472, 406, 416, 460, 468, 465, 464, 469, 461, 467, 466, 463, 462, 410, 413, 430, 438, 435, 434, 439, 431, 437, 436, 433, 432, 403, 412, 420, 428, 425, 424, 429, 421, 427, 426, 423, 422, 402, 14, 9, 900, 908, 918, 980, 988, 985, 984, 989, 981, 987, 986, 983, 982, 911, 915, 950, 958, 955, 954, 959, 951, 957, 956, 953, 952, 905, 940, 948, 945, 944, 949, 941, 947, 946, 943, 942, 904, 914, 909, 919, 990, 998, 995, 994, 999, 991, 997, 996, 993, 992, 901, 907, 917, 970, 978, 975, 974, 979, 971, 977, 976, 973, 972, 906, 916, 960, 968, 965, 964, 969, 961, 967, 966, 963, 962, 910, 913, 930, 938, 935, 934, 939, 931, 937, 936, 933, 932, 903, 912, 920, 928, 925, 924, 929, 921, 927, 926, 923, 922, 902, 19, 90, 98, 95, 94, 99, 91, 97, 96, 93, 92, 1, 100, 108, 118, 180, 188, 185, 184, 189, 181, 187, 186, 183, 182, 111, 115, 150, 158, 155, 154, 159, 151, 157, 156, 153, 152, 105, 140, 148, 145, 144, 149, 141, 147, 146, 143, 142, 104, 114, 109, 119, 190, 198, 195, 194, 199, 191, 197, 196, 193, 192, 101, 107, 117, 170, 178, 175, 174, 179, 171, 177, 176, 173, 172, 106, 116, 160, 168, 165, 164, 169, 161, 167, 166, 163, 162, 110, 113, 130, 138, 135, 134, 139, 131, 137, 136, 133, 132, 103, 112, 120, 128, 125, 124, 129, 121, 127, 126, 123, 122, 102, 7, 700, 708, 718, 780, 788, 785, 784, 789, 781, 787, 786, 783, 782, 711, 715, 750, 758, 755, 754, 759, 751, 757, 756, 753, 752, 705, 740, 748, 745, 744, 749, 741, 747, 746, 743, 742, 704, 714, 709, 719, 790, 798, 795, 794, 799, 791, 797, 796, 793, 792, 701, 707, 717, 770, 778, 775, 774, 779, 771, 777, 776, 773, 772, 706, 716, 760, 768, 765, 764, 769, 761, 767, 766, 763, 762, 710, 713, 730, 738, 735, 734, 739, 731, 737, 736, 733, 732, 703, 712, 720, 728, 725, 724, 729, 721, 727, 726, 723, 722, 702, 17, 70, 78, 75, 74, 79, 71, 77, 76, 73, 72, 6, 600, 608, 618, 680, 688, 685, 684, 689, 681, 687, 686, 683, 682, 611, 615, 650, 658, 655, 654, 659, 651, 657, 656, 653, 652, 605, 640, 648, 645, 644, 649, 641, 647, 646, 643, 642, 604, 614, 609, 619, 690, 698, 695, 694, 699, 691, 697, 696, 693, 692, 601, 607, 617, 670, 678, 675, 674, 679, 671, 677, 676, 673, 672, 606, 616, 660, 668, 665, 664, 669, 661, 667, 666, 663, 662, 610, 613, 630, 638, 635, 634, 639, 631, 637, 636, 633, 632, 603, 612, 620, 628, 625, 624, 629, 621, 627, 626, 623, 622, 602, 16, 60, 68, 65, 64, 69, 61, 67, 66, 63, 62, 10, 13, 30, 38, 35, 34, 39, 31, 37, 36, 33, 32, 3, 300, 308, 318, 380, 388, 385, 384, 389, 381, 387, 386, 383, 382, 311, 315, 350, 358, 355, 354, 359, 351, 357, 356, 353, 352, 305, 340, 348, 345, 344, 349, 341, 347, 346, 343, 342, 304, 314, 309, 319, 390, 398, 395, 394, 399, 391, 397, 396, 393, 392, 301, 307, 317, 370, 378, 375, 374, 379, 371, 377, 376, 373, 372, 306, 316, 360, 368, 365, 364, 369, 361, 367, 366, 363, 362, 310, 313, 330, 338, 335, 334, 339, 331, 337, 336, 333, 332, 303, 312, 320, 328, 325, 324, 329, 321, 327, 326, 323, 322, 302, 12, 20, 28, 25, 24, 29, 21, 27, 26, 23, 22, 2, 200, 208, 218, 280, 288, 285, 284, 289, 281, 287, 286, 283, 282, 211, 215, 250, 258, 255, 254, 259, 251, 257, 256, 253, 252, 205, 240, 248, 245, 244, 249, 241, 247, 246, 243, 242, 204, 214, 209, 219, 290, 298, 295, 294, 299, 291, 297, 296, 293, 292, 201, 207, 217, 270, 278, 275, 274, 279, 271, 277, 276, 273, 272, 206, 216, 260, 268, 265, 264, 269, 261, 267, 266, 263, 262, 210, 213, 230, 238, 235, 234, 239, 231, 237, 236, 233, 232, 203, 212, 220, 228, 225, 224, 229, 221, 227, 226, 223, 222, 202, 0},Dinglemouse.sort(new int[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671, 672, 673, 674, 675, 676, 677, 678, 679, 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691, 692, 693, 694, 695, 696, 697, 698, 699, 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711, 712, 713, 714, 715, 716, 717, 718, 719, 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731, 732, 733, 734, 735, 736, 737, 738, 739, 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, 752, 753, 754, 755, 756, 757, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, 792, 793, 794, 795, 796, 797, 798, 799, 800, 801, 802, 803, 804, 805, 806, 807, 808, 809, 810, 811, 812, 813, 814, 815, 816, 817, 818, 819, 820, 821, 822, 823, 824, 825, 826, 827, 828, 829, 830, 831, 832, 833, 834, 835, 836, 837, 838, 839, 840, 841, 842, 843, 844, 845, 846, 847, 848, 849, 850, 851, 852, 853, 854, 855, 856, 857, 858, 859, 860, 861, 862, 863, 864, 865, 866, 867, 868, 869, 870, 871, 872, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 883, 884, 885, 886, 887, 888, 889, 890, 891, 892, 893, 894, 895, 896, 897, 898, 899, 900, 901, 902, 903, 904, 905, 906, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 975, 976, 977, 978, 979, 980, 981, 982, 983, 984, 985, 986, 987, 988, 989, 990, 991, 992, 993, 994, 995, 996, 997, 998, 999}));
CodeWars say arrays first differed at element [1]; expected:800 but was:18
It's correct? When I try the test in my IDE him is OK
In this test:
assertArrayEquals(new int[]{8, 18, 800, 808, 818, 880, 888, 885, 884, 889, 881, 887, 886, 883, 882, 811, 815, 850, 858, 855, 854, 859, 851, 857, 856, 853, 852, 805, 840, 848, 845, 844, 849, 841, 847, 846, 843, 842, 804, 814, 809, 819, 890, 898, 895, 894, 899, 891, 897, 896, 893, 892, 801, 807, 817, 870, 878, 875, 874, 879, 871, 877, 876, 873, 872, 806, 816, 860, 868, 865, 864, 869, 861, 867, 866, 863, 862, 810, 813, 830, 838, 835, 834, 839, 831, 837, 836, 833, 832, 803, 812, 820, 828, 825, 824, 829, 821, 827, 826, 823, 822, 802, 80, 88, 85, 84, 89, 81, 87, 86, 83, 82, 11, 15, 50, 58, 55, 54, 59, 51, 57, 56, 53, 52, 5, 500, 508, 518, 580, 588, 585, 584, 589, 581, 587, 586, 583, 582, 511, 515, 550, 558, 555, 554, 559, 551, 557, 556, 553, 552, 505, 540, 548, 545, 544, 549, 541, 547, 546, 543, 542, 504, 514, 509, 519, 590, 598, 595, 594, 599, 591, 597, 596, 593, 592, 501, 507, 517, 570, 578, 575, 574, 579, 571, 577, 576, 573, 572, 506, 516, 560, 568, 565, 564, 569, 561, 567, 566, 563, 562, 510, 513, 530, 538, 535, 534, 539, 531, 537, 536, 533, 532, 503, 512, 520, 528, 525, 524, 529, 521, 527, 526, 523, 522, 502, 40, 48, 45, 44, 49, 41, 47, 46, 43, 42, 4, 400, 408, 418, 480, 488, 485, 484, 489, 481, 487, 486, 483, 482, 411, 415, 450, 458, 455, 454, 459, 451, 457, 456, 453, 452, 405, 440, 448, 445, 444, 449, 441, 447, 446, 443, 442, 404, 414, 409, 419, 490, 498, 495, 494, 499, 491, 497, 496, 493, 492, 401, 407, 417, 470, 478, 475, 474, 479, 471, 477, 476, 473, 472, 406, 416, 460, 468, 465, 464, 469, 461, 467, 466, 463, 462, 410, 413, 430, 438, 435, 434, 439, 431, 437, 436, 433, 432, 403, 412, 420, 428, 425, 424, 429, 421, 427, 426, 423, 422, 402, 14, 9, 900, 908, 918, 980, 988, 985, 984, 989, 981, 987, 986, 983, 982, 911, 915, 950, 958, 955, 954, 959, 951, 957, 956, 953, 952, 905, 940, 948, 945, 944, 949, 941, 947, 946, 943, 942, 904, 914, 909, 919, 990, 998, 995, 994, 999, 991, 997, 996, 993, 992, 901, 907, 917, 970, 978, 975, 974, 979, 971, 977, 976, 973, 972, 906, 916, 960, 968, 965, 964, 969, 961, 967, 966, 963, 962, 910, 913, 930, 938, 935, 934, 939, 931, 937, 936, 933, 932, 903, 912, 920, 928, 925, 924, 929, 921, 927, 926, 923, 922, 902, 19, 90, 98, 95, 94, 99, 91, 97, 96, 93, 92, 1, 100, 108, 118, 180, 188, 185, 184, 189, 181, 187, 186, 183, 182, 111, 115, 150, 158, 155, 154, 159, 151, 157, 156, 153, 152, 105, 140, 148, 145, 144, 149, 141, 147, 146, 143, 142, 104, 114, 109, 119, 190, 198, 195, 194, 199, 191, 197, 196, 193, 192, 101, 107, 117, 170, 178, 175, 174, 179, 171, 177, 176, 173, 172, 106, 116, 160, 168, 165, 164, 169, 161, 167, 166, 163, 162, 110, 113, 130, 138, 135, 134, 139, 131, 137, 136, 133, 132, 103, 112, 120, 128, 125, 124, 129, 121, 127, 126, 123, 122, 102, 7, 700, 708, 718, 780, 788, 785, 784, 789, 781, 787, 786, 783, 782, 711, 715, 750, 758, 755, 754, 759, 751, 757, 756, 753, 752, 705, 740, 748, 745, 744, 749, 741, 747, 746, 743, 742, 704, 714, 709, 719, 790, 798, 795, 794, 799, 791, 797, 796, 793, 792, 701, 707, 717, 770, 778, 775, 774, 779, 771, 777, 776, 773, 772, 706, 716, 760, 768, 765, 764, 769, 761, 767, 766, 763, 762, 710, 713, 730, 738, 735, 734, 739, 731, 737, 736, 733, 732, 703, 712, 720, 728, 725, 724, 729, 721, 727, 726, 723, 722, 702, 17, 70, 78, 75, 74, 79, 71, 77, 76, 73, 72, 6, 600, 608, 618, 680, 688, 685, 684, 689, 681, 687, 686, 683, 682, 611, 615, 650, 658, 655, 654, 659, 651, 657, 656, 653, 652, 605, 640, 648, 645, 644, 649, 641, 647, 646, 643, 642, 604, 614, 609, 619, 690, 698, 695, 694, 699, 691, 697, 696, 693, 692, 601, 607, 617, 670, 678, 675, 674, 679, 671, 677, 676, 673, 672, 606, 616, 660, 668, 665, 664, 669, 661, 667, 666, 663, 662, 610, 613, 630, 638, 635, 634, 639, 631, 637, 636, 633, 632, 603, 612, 620, 628, 625, 624, 629, 621, 627, 626, 623, 622, 602, 16, 60, 68, 65, 64, 69, 61, 67, 66, 63, 62, 10, 13, 30, 38, 35, 34, 39, 31, 37, 36, 33, 32, 3, 300, 308, 318, 380, 388, 385, 384, 389, 381, 387, 386, 383, 382, 311, 315, 350, 358, 355, 354, 359, 351, 357, 356, 353, 352, 305, 340, 348, 345, 344, 349, 341, 347, 346, 343, 342, 304, 314, 309, 319, 390, 398, 395, 394, 399, 391, 397, 396, 393, 392, 301, 307, 317, 370, 378, 375, 374, 379, 371, 377, 376, 373, 372, 306, 316, 360, 368, 365, 364, 369, 361, 367, 366, 363, 362, 310, 313, 330, 338, 335, 334, 339, 331, 337, 336, 333, 332, 303, 312, 320, 328, 325, 324, 329, 321, 327, 326, 323, 322, 302, 12, 20, 28, 25, 24, 29, 21, 27, 26, 23, 22, 2, 200, 208, 218, 280, 288, 285, 284, 289, 281, 287, 286, 283, 282, 211, 215, 250, 258, 255, 254, 259, 251, 257, 256, 253, 252, 205, 240, 248, 245, 244, 249, 241, 247, 246, 243, 242, 204, 214, 209, 219, 290, 298, 295, 294, 299, 291, 297, 296, 293, 292, 201, 207, 217, 270, 278, 275, 274, 279, 271, 277, 276, 273, 272, 206, 216, 260, 268, 265, 264, 269, 261, 267, 266, 263, 262, 210, 213, 230, 238, 235, 234, 239, 231, 237, 236, 233, 232, 203, 212, 220, 228, 225, 224, 229, 221, 227, 226, 223, 222, 202, 0},Dinglemouse.sort(new int[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671, 672, 673, 674, 675, 676, 677, 678, 679, 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691, 692, 693, 694, 695, 696, 697, 698, 699, 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711, 712, 713, 714, 715, 716, 717, 718, 719, 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731, 732, 733, 734, 735, 736, 737, 738, 739, 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, 752, 753, 754, 755, 756, 757, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, 792, 793, 794, 795, 796, 797, 798, 799, 800, 801, 802, 803, 804, 805, 806, 807, 808, 809, 810, 811, 812, 813, 814, 815, 816, 817, 818, 819, 820, 821, 822, 823, 824, 825, 826, 827, 828, 829, 830, 831, 832, 833, 834, 835, 836, 837, 838, 839, 840, 841, 842, 843, 844, 845, 846, 847, 848, 849, 850, 851, 852, 853, 854, 855, 856, 857, 858, 859, 860, 861, 862, 863, 864, 865, 866, 867, 868, 869, 870, 871, 872, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 883, 884, 885, 886, 887, 888, 889, 890, 891, 892, 893, 894, 895, 896, 897, 898, 899, 900, 901, 902, 903, 904, 905, 906, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 975, 976, 977, 978, 979, 980, 981, 982, 983, 984, 985, 986, 987, 988, 989, 990, 991, 992, 993, 994, 995, 996, 997, 998, 999}));
CodeWars say arrays first differed at element [1]; expected:<800> but was:<18>
It's correct? When I try the test in my IDE him is OK
Yes, the CW message
arrays first differed at element [1]; expected:800 but was:18
is correct.The question you should be asking yourself is how did 60 other people pass this if the test was wrong... maybe the test is NOT wrong.
I am curious where does that assertArrayEquals expected result come from? Did you write that assert yourself? It is incorrect.
you're right!...
congrats #61
This comment has been hidden.
Agreed - the tests only pass if I misspell 18 as 'eightteen'
@neilj - which language? please tell me where is the mispelled eighteen you found so I can fix it
This comment has been hidden.
Sorry, WYSIWYG
I second it, lol :) | Let's build a library let's go!
This comment has been hidden.
I was trying to figure out why I couldn't pass one of the random tests by displaying the array of integers. It bypassed the test and allowed me to submit my code. See the comment at line 9: https://www.codewars.com/kata/reviews/56f53a5b6dc4feeaa2000044/groups/58d1e2f7f4080cf53d0000bb
Hi @Deepfreeze. Not sure I understand exactly what happened.
Any chance maybe your solution fails only for a rare case, and you just got lucky with a different bunch of random numbers for your submit that was accepted?
What did that message say?
Hi @Deepfreeze.
Cheers, DM
BTW - Your solution is not coping well with numbers like
808
where 2nd digit is a 0.I was pretty certain the issue wasn't with your test code, the odd part is that when it bypasses a fail, it logs the error in stdout. Ahh good to know :) that means I can go back and refactor now. Thanks
Keep making katas by the way :) I'm running out of Java katas below my kyu :O
Am I supposed to sort values like 808 as "eight hundred eight" or "eight hundred zero eight"? Because from what I can see, it's handling it correctly for "eight hundred eight".
I figured out my bug, it was replacing the "385" with extra value of "912"
My bad. Sorry, I jumped to wrong conclusion from a test error message :-(
Hey, thanks for the encouragement! Another one is coming as soon as I can clean it up a bit. Stay tuned :-)
.
@docgunthrop
thanks for approving :-)This comment has been hidden.
This comment has been hidden.
don't understand the question. please make me understand. sort the numbers " By name ... " ???
Numbers -> Names
Sort the names of the numbers So
[1,2,3]
->[1,3,2]
Translated to
JavaScript
:-)