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.
looks great, but unfortunatelly O(n log n), it can be O(n).
Our solutions have the same time complexity but different readability
Part inside the parentheses is a group, so regex is "(1st group 3 digits)(2nd group 3 digits)(3rd group 4 digits)", dollar sign means group so we change found regex to "(1st group) 2nd group-3rd group", that's it
What?! 😵💫
This comment is hidden because it contains spoiler information about the solution
You could replace the brackets
{ }
by parenthesis( )
and removing thereturn
keyword.wonderful explanations, thank you greatly!
just gave you a follow, if i have any dire questions down the line, i will be sure to reach out.
the === is used in JS to compare values and data types, because == does the type conversion before comparing (you can try to compare 2 and "2" with == and then with === and if i am not mistaken both of these will give you different answer
? : is a ternary operator, you can think of it as shorthand for if/else statement
? condition is true : condition is false
i recommend using ternary operator only with simple if/else statements and i do not recommend nesting ternary operator, i believe you can find some videos about use cases of ternary op. on YT
if you have more questions feel free to message me, i am happy to help
im having a hard time understanding the usage of ? and : and ===
any insight?
[TypeScript] The test runner logs are not a place to advertise katas or beg for feeback/rank/vote. Also, please don't mess with the color for no reason.
Ok... Are you talking about an issue in the initial solution? It doesn't work by default ;P But sure, changed.
[TypeScript]
The types for the TypeScript translation are incorrect.
String
represents the gloabl string object, it is not the right type to use for a primitive string.string
should be used instead for the parameters and return type.See https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#the-primitives-string-number-and-boolean
and https://www.typescriptlang.org/docs/handbook/declaration-files/do-s-and-don-ts.html#general-types
in the TypeScript handbook.
[TypeScript]
The types for the TypeScript translation are incorrect.
String
represents the gloabl string object, it is not the right type to use for a primitive string.string
should be used instead for the return type.See https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#the-primitives-string-number-and-boolean
and https://www.typescriptlang.org/docs/handbook/declaration-files/do-s-and-don-ts.html#general-types
in the TypeScript handbook.
[TypeScript]
Consider using an assertion method that accounts for floating point errors (like
closeTo
orapproximately
), especially when the naïve solution can be resolved using trigonometric functions or the square root operator.[TypeScript]
The types for the TypeScript translation are incorrect.
String
represents the gloabl string object, it is not the right type to use for a primitive string.string
should be used instead for the parameter.See https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#the-primitives-string-number-and-boolean
and https://www.typescriptlang.org/docs/handbook/declaration-files/do-s-and-don-ts.html#general-types
in the TypeScript handbook.
Kinda ironic for a kata tagged with "string" and "fundamentals".
Loading more items...