Retired

Next Largest Value (by rearranging the last digit and the last by one if neccessary) (retired)

Description
Loading description...
Fundamentals
Algorithms
Arrays
  • Please sign in or sign up to leave a comment.
  • Voile Avatar

    Sample tests are missing.

  • smile67 Avatar

    Wrong tests (so your code is wrong too) - you don't check if there's a next bigger number, you only check if you can change the last two digits for a bigger number...

    • Dragomirc Avatar

      Thank you for your feedback. Would you be able to give me some more details on your comment, as I was thinking that by checking if I can cahnge the last two digits for a bigger number, is the check if there is a next bigger number. Thank you in advance

    • smile67 Avatar

      Not really, look at 1243 so 1234 is not bigger, but for example 1324;-)...

    • JohanWiltink Avatar

      Are you seriously asking him to do your homework for you ?!? :S

    • cliffstamp Avatar

      I rewrote the description to clarify what people were doing, and replacted the reference solution with a much cleaner piece of code, and used DeepEquals.

      Issue marked resolved by cliffstamp 6 years ago
  • JohanWiltink Avatar

    Is any of this new?

    Finding the next greater number with the same digits has been done, and reversing things is mentioned specifically as "well represented", i.e. done to death. And no, returning an array isn't new either.

    So what's new enough to warrant a new kata?

    • Dragomirc Avatar

      Hi Johan,

      Thank you for your feedback. I've searched for a Kata requesting the next greater number with the same digits and couldn't find one. Please let me know if mine's a duplicate. Forgive my ignorance as I'm newish on codewars.

      Thank you in advance

    • JohanWiltink Avatar

      Next bigger number with the same digits

      Really, it's a duplicate.

      It's not always easy to find duplicates - names are not always descriptive (somebody once unknowingly made a duplicate of Skrzat. yeah, not a miracle he couldn't find that :yum: ), and the kata search function is limited. A Google search may give better results than a local site search ( google:"site:codewars.com next number same digits" ).

    • smile67 Avatar

      Not really, the tests work different - see my issue;-) So he can change the description (no duplicate, but sense?) or his code/tests... than it's a duplicate;-)

    • JohanWiltink Avatar

      There's duplicate and there's bad implementation. And they're not mutually exclusive .. ;]

    • smile67 Avatar

      :-)... next time, next try...

    • Dragomirc Avatar

      Hi Gents,

      Thanks for all your help. The Kata "Next bigger number with the same digits" is a more complicated version of mine( I wasn't aware about its existance, when I created mine). My Kata checks whether there is an existing next larger value by inversing just the last two digits, otherwise it retruns the same number. I was wandering if my Kata can qualify as a simplified version of the existing one, which can be ranked much lower, thus new starters as me can take advantage of?

      Thank you in advance

    • JohanWiltink Avatar

      You'd have to specify expected behaviour exactly, and to me it would feel like a contrived, unnatural, illogical task.

      If in this way you wanted to get around the fact that your idea isn't new, you could do that. Frankly, I would not care for it much, but you're not beholden to my opinion.

      Also, you'd have to rename the kata. People would be getting wrong ideas.

    • Dragomirc Avatar

      Thank you Johan. I've just updated the name and expected behaviour. Will be shortly working on new Kata with your feedback in mind. Wish u a nice evening.

  • JohanWiltink Avatar

    Are you sure your description example is correct? Shouldn't the 2nd element be 45321595695 ?