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.
if he used const that makes him can't erase
It's bad practice to remove them. It's relying on the tests to include them instead, which leaves these solutions prone to being automatically invalidated in the future if the tests change and their solutions don't compile anymore. The line or two saved by omitting them isn't worth that risk, so you're doing good by keeping them in
why theres no #include
i tried it without the lib but dosnt work for me
Very readable and logical. Oh, this language design...
where did 'const' go?
thats clever. gj wp gg
Whilst this solution does pass the test it has changed the parameter from a const. This would be considered bad practice as it edits the original value.
You learn by doing.... you found a way to do it! Give yourself some credit.
I FEEL SO STUPID RN
I feel so stupid after seeing this.
After reading Clean Code... Yes, you are right! :)
In my opinion, the method shouldn't be affecting the input array. In clean code this is known as a side effect that might damage the program causing temporal couplings. I don't think it makes much sense having two arrays containing the result, the one passed as an argument and the one returned by the function.
I suppose the method must not impact on the original array.
Really? The tests should check that the solution doesn't mess with the input array.
This comment is hidden because it contains spoiler information about the solution