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.
It's not necessarily obvious the 7000 is in ms. The code could alternatively be explicit/obvious about that.
Try "Ailce, Alice, Alice"
You may be surprised :)
This code defines a Compare method that takes in two strings, line1 and line2, and compares them based on a predetermined order. The method returns a positive value if line2 should come before line1 in the order, a negative value if line1 should come before line2, and 0 if the two lines are equal.
The method begins by defining an array of strings called order, which represents the order in which the lines should be sorted. The array includes strings such as "a ", "2 ", "3 ", etc., which represent different categories of lines that should be sorted in a specific order.
Next, the method returns the difference between the indices of line2 and line1 in the order array. The indices are determined using the Array.IndexOf method, which returns the index of the first occurrence of a given value in an array. If either line1 or line2 is not found in the order array, the Array.IndexOf method returns -1.
The [..2] syntax at the end of each line indicates that the comparison should be based on the first two characters of line1 and line2, respectively. This means that the method will compare the first two characters of each line and use the predetermined order to determine which line should come first.
For example, if line1 is "a line" and line2 is "3 line", the method will return a positive value because "3 " comes before "a " in the order array. On the other hand, if line1 is "5 line" and line2 is "a line", the method will return a negative value because "a " comes before "5 " in the order array.
Not a correct solution: "aaaabb"
When F# is selected, the description shows a code block for Ruby.
fix the typos in the function name