ternary operator
I'm no idea what means ":" and "?" in "return" . How do I google this?
Never thought of using the modulo operator that way! Excellent.
GG bro.. I can imagine the struggle lol
sorry man...trying to get used to the platform
Use spoiler flag next time, please.
This comment is hidden because it contains spoiler information about the solution
How could i be so stupid ? ......
Once I heard that division operation is very "expensive" (programmatically). Isn't better store the division result in a variable to avoid divide twice?
one thing that can be improved: using [...xs] instead of xs.
[...xs]
xs
yeah , that's more clearly than "%1? -1"
Option: define a var for Math.sqrt(sq) to avoid the extra calc. You are calculating Math.sqrt(sq) twice. The next comment already stated that... woops
Math.sqrt(sq)
an integer returns 0 which is evaluated as false.
The test case is correct though?
[1, 2, 3, 4, 3, 6], not increasing remove element at index 4 [1, 2, 3, 4, 6], now strictly increasing! Therefore true
what about Test.assertEquals(almostIncreasingSequence([1, 2, 3, 4, 3, 6]), true) ? it will fail testing!
Test.assertEquals(almostIncreasingSequence([1, 2, 3, 4, 3, 6]), true)
ternary operator
I'm no idea what means ":" and "?" in "return" . How do I google this?
Never thought of using the modulo operator that way! Excellent.
GG bro.. I can imagine the struggle lol
sorry man...trying to get used to the platform
Use spoiler flag next time, please.
This comment is hidden because it contains spoiler information about the solution
How could i be so stupid ? ......
Once I heard that division operation is very "expensive" (programmatically). Isn't better store the division result in a variable to avoid divide twice?
one thing that can be improved: using
[...xs]
instead ofxs
.yeah , that's more clearly than "%1? -1"
Option: define a var for
Math.sqrt(sq)
to avoid the extra calc. You are calculatingMath.sqrt(sq)
twice.The next comment already stated that... woops
an integer returns 0 which is evaluated as false.
The test case is correct though?
what about
Test.assertEquals(almostIncreasingSequence([1, 2, 3, 4, 3, 6]), true)
? it will fail testing!Loading more items...