7 kyu

Sort Out The Men From Boys

549 of 10,686MrZizoScream
Description
Loading description...
Fundamentals
Algorithms
Sorting
  • Please sign in or sign up to leave a comment.
  • iNikAnn Avatar

    Wow, what a brief description! I wish you had added a few more pages to really clarify things 👍

  • ejini战神 Avatar

    This comment has been hidden.

  • enriquemoyamx Avatar

    This comment has been hidden.

  • stufev Avatar

    This comment has been hidden.

  • Tofuzius  Avatar

    This kata made me wonder, what would be the best way to remove the duplicates in an array of ints in C. I thought about something like a hashtable but decided to simply sort the ints and remove the duplicates afterwards because that was much simpler to implement for me. What do you think is the most efficient way to build a set of ints in this case?

  • Dovakiin Avatar

    Has someone resolved this using custom Swift SortComparator?

  • bouchert Avatar

    Am I missing something in the problem description? Why does the C++ reference solution return {72, 22, -10, -22} when given {72, -10, 22, -22} as input? Shouldn't the correct answer be {-22, -10, 22, 72}?

  • chelseawelch Avatar

    The exercise of the kata is great. The forced use of stretched stereotypes in the instructions is lame. (IMO)

  • selimcan Avatar

    Real men don't use smileys.

  • ragota1704 Avatar

    please change: "Repetition of numbers in the array/list could occur , So (duplications are not included when separating)." to: "Repetition of numbers in the array/list could occur , So don't return duplicates."

  • user240425 Avatar

    Can we stop with all the annoying emojis? They clutter and make the kata descriptions more difficult to read. Also, what's with the insanely large headers?

    • Just make headers in bold.
    • No emojis
    • No large horizontal lines (Use 2-3 new lines in stead)
  • Wouter125 Avatar

    Swift translation kumited :)

  • imjasonmiller Avatar

    Rust translation kumited :-)

  • astronaute Avatar

    This comment has been hidden.

  • yue-123 Avatar

    C language : int *men_from_boys(const int *values, int count, int *new_count) stupid...I don't know what's the usage of "*new_account" above.

  • bdw429s Avatar
  • B1ts Avatar

    Manly Prolog translation kumited!

  • MikChan Avatar

    The weirdest one I've done on this website yet...

  • alexwade94 Avatar

    This comment has been hidden.

  • user8436785 Avatar
  • user8436785 Avatar
  • user8436785 Avatar
  • user8436785 Avatar
  • stellartux Avatar
  • katagrinder Avatar

    Anyone knows a great guide to lambda :3

  • user8436785 Avatar

    Dart translation kumited (oh, just noticed there's more dart to do :wink:)

  • user8436785 Avatar
  • JoshWhipple17 Avatar

    This is weird, when I display my answer(which is an array) in the console it is correct but when I try return the answer(which is an array) it runs my code multiple times which causes me to get the answer wrong. Why is it doing that? scratching my head

  • stepanovich Avatar

    This comment has been hidden.

  • clcraig Avatar

    @MrZizoScream, C and Java translations available.

  • cliffstamp Avatar
  • FArekkusu Avatar

    Are you so much pathetic/butthurt that you will downvote all my 600 comments? :D

  • JohanWiltink Avatar

    If you're going to specify Expected and Efficient Time Complexity, I expect an example solution that actually showcases the Efficient Time Complexity. The JavaScript translation at least, doesn't ( and it would have been easy to do if the original language example solution had ).

    I also expect the Efficient one to be attainable, and I'm quite sure it isn't in this case. I would love to be proven wrong, but sorting things takes at least O(n log n), and ( again ) you are implying sorting can be done in O(n). For God's sake man, show us how it's done, you'd revolutionise computing !!

    I haven't actually checked, but do the tests really expect at least an O(n log n) solution, and thus fail an O(n²) one? Somehow I doubt it, and there ought to be truth in advertising and kata descriptions.

  • Blind4Basics Avatar

    maybe you could rewrite the description a bit? This one has stil some of yours "old fashion ways" (not sure about the translation, sorry if that means nothing x) ), lots of colors, bolds, italics, caps and all of that mixed together... ;)

  • FArekkusu Avatar

    Python translation available. Please, review and approve.

  • NunoOliveira Avatar

    How is this what is requested?

    It should work for random inputs too - Expected: '[71, -86, -766, -288, -18, 463, 10, -28, 100, -4, -10, 12, 88, 4, 859, -68, 74, 8, 52, 343, 327, 185, 89, 47, 27, 7, -13, -95]', instead got: '[-766, -288, -86, -68, -28, -18, -10, -4, 4, 8, 10, 12, 52, 74, 88, 100, 859, 463, 343, 327, 185, 89, 71, 47, 27, 7, -13, -95]'

  • tachyonlabs Avatar

    Random tests in JavaScript seem pretty messed up -- after passing all the Basic tests, I get error messages like this (and I'm not modifying the input array):

    Testing [-683, 41, 1, 8, 139, -158, 524, -525, -654, 958, 394, -7, -190, -277, 867, 569, -354, 73]
    It should work for random inputs too - Expected: '[958, 73, -354, 8, 139, -158, 524, 569, -654, 867, 394, -190, 41, 1, -7, -277, -525, -683]', instead got: '[-654, -354, -190, -158, 8, 394, 524, 958, 867, 569, 139, 73, 41, 1, -7, -277, -525, -683]'
    
  • Voile Avatar

    I'm repeating this again from the previous version of this kata:

    I find the sample tests very unhelpful in debugging code. Why not just have simple and easy to reason test cases like these? These 4 tests alone are more instructive than the 15 tests you have right now.

    positive numbers: [0,1,2,3,4,5,6,7,8,9]
    negative numbers: [0,-1,-2,-3,-4,-5,-6,-7,-8,-9]
    mixed numbers: [-5,-4,-3,-2,-1,0,1,2,3,4]
    duplicates: [0,0,1,1,2,2,3,3,4,4]