Retired
Next Largest Value (by rearranging the last digit and the last by one if neccessary) (retired)
Loading description...
Fundamentals
Algorithms
Arrays
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.
Sample tests are missing.
Fixed.
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...
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
Not really, look at 1243 so 1234 is not bigger, but for example 1324;-)...
Are you seriously asking him to do your homework for you ?!? :S
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.
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?
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
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" ).
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;-)
There's duplicate and there's bad implementation. And they're not mutually exclusive .. ;]
:-)... next time, next try...
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
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.
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.
Are you sure your description example is correct? Shouldn't the 2nd element be
45321595695
?Thanks for spotting my typo. I've just corrected it.
.