"Given 2 arguments, an array and an integer (represented by k), your task is to return a string that represents the very first longest block of consecutive elements in the array. The amount of elements permitted in the block is represented by k.
if n being the length of the array; if n = 0 or k > n or k <= 0 return ""."
Test Passed: Value == 'practice till you master!'
Test Passed: Value == 'Speak out loud!'
Test Passed: Value == 'anything you practice, you will be good at!
"you have to remove those pauses (redundant/unnecessary spaces)." .. so i thought we had to output it without spaces
but in my tests is expecting it with the spaces..
Your if statement is wrong. After sorting the array (example) [1,2,3,2,1], it looks like this [1,1, 2, 2, 3]. But your if statement does this:
if ( 1 == 1 && 1 != 2){returns true} (1 == 2 && 1 != 2){returns false} and so on...
"So, as long as the integers and their sum are never larger than 53 bits in magnitude..." "a and b will always be valid integers." , so a and b they always safe or not?
check rantenor's comment...
"Given 2 arguments, an array and an integer (represented by k), your task is to return a string that represents the very first longest block of consecutive elements in the array. The amount of elements permitted in the block is represented by k.
if n being the length of the array; if n = 0 or k > n or k <= 0 return ""."
See the example tests.
paste some of the error here so we can help :)
"you have to remove those pauses (redundant/unnecessary spaces)." .. so i thought we had to output it without spaces
but in my tests is expecting it with the spaces..
yes you right mate, tks for pointing that out
toString() seems redundant since toFixed() returns a string anyway. Maybe am I something missing though?
Sorry for late reply.
Your if statement is wrong. After sorting the array (example) [1,2,3,2,1], it looks like this [1,1, 2, 2, 3]. But your if statement does this:
if ( 1 == 1 && 1 != 2){returns true} (1 == 2 && 1 != 2){returns false} and so on...
It works now.
yeah all passed now ;)
cheers
@Unnamed, please confirm it's all OK.
JS? It's fixed now.
dont get it..at the basic tests seems like strings but at random they look like arrays..
"So, as long as the integers and their sum are never larger than 53 bits in magnitude..." "a and b will always be valid integers." , so a and b they always safe or not?
After 700 completions, is this necessary?
You should also state that array "arr" does not have to be sorted.
P.S.
Sort the array "arr" before you use it for solutions :) .
Loading more items...