Ad
  • Custom User Avatar

    isnt sort supposed to be time consuming? instead of just a single pass you are doing an nlogn operation just for sorting

  • Default User Avatar

    Unusual feature request: Sell Codewars t-shirts! I would buy several for my students and me. (Sorry if this is inappropriate for this forum. I couldn't figure out where else to post it.)

  • Custom User Avatar

    The more I work in the dynamic languages here, the more I think we need a 'efficient' vote as well as best practices and clever. While best practices and cleverness are good, I see too many answers that are O(n^2) solutions for questions that have a very clear O(n) solution that are voted to the top because they are a single line and use some cool language features.

    I think these answers are great and they show you some really neat aspects of certain languages but they are not solutions that would be production ready and often overshadow the most efficient solutions

  • Custom User Avatar

    Is there any request for a efficent voting mechanism? I would love that.

  • Custom User Avatar

    All? short circuts.

  • Default User Avatar

    You should stop once you witness failure of monotonicity, e.g. don't traverse the whole array if heights[0] > heights[1]. That way your average complexity will be even better than linear.

  • Custom User Avatar

    More stats. How long did I take to solve it? Avereage solve time. A kata breakdown(how I earned what, it seems I randomly got 40 kata). What languages do I spend the most time solving? What langauges do I spend the least time? Change in leadership position over time. Any more tracking would be cool to look at.

  • Custom User Avatar

    It doesn't provide a way to submit tests though. You need to submit a solution and see that output.
    Also the user documentation seems out of date (the returned output does not match what they say should be returned) so it is resonable to assume the rest could be out of date.

  • Custom User Avatar

    No test cases with words with apostrophe.

  • Custom User Avatar

    Comparing an array like that would be n, linear.

  • Custom User Avatar

    Absolutely, you don't happen to know the Big O time for comparing do you?

  • Custom User Avatar

    I really like this solution, your process_items is very clean and short. I'm curious why you decided to use two lists instead of a hash though? Also, don't you need to reset your @identify to proc {|obj| obj} in your reset? Otherwise you would be using the identify from the previous batch job.

  • Custom User Avatar

    Regex usually isn't the best for readability but it's a lot cleaner than how I removed the _ and =. I'm new to ruby so bare with me when I ask, are ternary operators prefered? I see them everywhere in the solutions but I've never liked the way read vs a regular if else.

  • Custom User Avatar

    Haha yeah, ruby has a lot of hidden gems(tee hee) in the collections docs

  • Custom User Avatar

    Nice. Your solution uses methods I wasn't familiar with (total beginner)

  • Loading more items...