You need to sign in or sign up before continuing.×
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.
The C# version (and Java version) has broken tests for random lengths because the precision of double breaks down when the number of digits exceeds 15 or 16.
The C# version has the same problem, the precision of double starts to break down after 15 or 16 digits and the tests sometimes pass and sometimes fail depending on how high the random length value happened to go.
For all the people reading the solutions and thinking that this is a "best practice", it isn't.
Yes it is clever, but it is very inefficient in runtime execution and if you get a question like this in an interview the interviewer will likely not be impressed with this answer because it doesn't show you know how to actually write an algorithm.
This is a simple way to "solve" the problem but it doesn't demonstrate any understanding of how to actually write an algorithm which is the whole point of questions like these, especially if you are practicing for interviewing.
Calling an existing function like this in a production system (when it doesn't cause a performance problem) is a good way to get your job done quickly but it executes 20X slower than writing the for loop yourself.
P.S. Read my solution that presents two algorithm options for examples of the kinds of responses interviewers are actually looking for.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
The reversal of the array is unnecessary, just swap the print order in the returned string.
I do like your use of Array.ConvertAll, I forgot about that method.