Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Confirmed. Thanks. Was C# 12 added to Codwars last month (Nov '24)?
https://www.codewars.com/post/whats-new-on-codewars-november-2024
The OP wrote this question 5 months ago. I wanted to share the idea of identity-functions as an FP practice to anyone interested.
Anyone remiss about not having Order can use OrderBy instead with an identity-function as the key-selector.
If you are so inclined, you can dig as deeply as you like into the implementations and overloads of these Order/OrderBy methods with the source that MS provides online. Be aware that Microsoft has gone to great lengths to make these perform well. Older, simpler implementations are available at Microsoft's reference-source site -- but these are frozen in time and won't include the latest things like this
Order
extension.Updated test cases. Didn't do the PS, but recognize that it's a good suggestion. Marking resolved.
I haven't been on in some time. I have added some examples and my own brief description of what a pronic number is. Thanks for the suggestion. Let me know what you think.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
I really liked the original -- mapping to JSON.parse was the clever part.
Using reduceRight eliminated the need to reverse.
Nice! :)
If you're asking this question, you probably have issues with the larger numbers in the submission tests.
Without seeing your code, it's impossible to know.
If you're timing out, it's hard to say whether your approach needs a simple tweak or a complete overhaul.
Quick -- pretend like you're the computer running your algorithm and answer the following:
What's the next smaller number from 90000001 with the same digits?
Do you sense that you're doing unncessary work? Is there a simplification you can do?
If that's no problem,try the same with the following: 912345678?
If these are hard for you to attempt doing by hand using the algorithm you coded -- you should rethink your algorithm.
If that's too much you might try a similar experiment in a debugger, stepping line-by-line and noting where your code is spending its time. Is there any unnecessary/pointless work being done?
If that doesn't help, read the troubleshooting guide available in the codewars docs.
Good luck! IMO it's the challenge of this exercise that makes it worth figuring out.
This comment is hidden because it contains spoiler information about the solution
Excellent points -- I would reinstate the list and the "if q" guard on the append. Particularly after finding this reaffirmation: https://stackoverflow.com/a/2414916
I love this solution; it is among the few for this kata that use functional programming at all. IMO, the lambda syntax in Python as compared to other languages where it is shorter makes it less desirable. I'm no language designer, I believe alternatives were weighed and there's good reason for it being this way.
Among other qualities I appreciate, I like the limited abbreviations. Most solutions (including mine) use single letter variable names; this one uses: KEYBOARD, digit, sequence. It does use "q" and "r" -- for "quotient" and "remainder" -- which I can still appreciate over more generic: i,j,k,m,n,w,x,y,z or names that echo the type like 'str' (ooh, that's the argument to our method.)
I will attempt a kumite/fork to explore a couple ideas. Well-done! 👍
Loading more items...