+ 1
Does this code give a different output on your editor?
This is one of leetcode problems i solved and it worked perfectly here on sololearn and an online text editor i ran it on("jsbin"). But upon testing it on leetcode's editor, it kept on giving a different output. The code is supposed to take a specified portion of an array from it end and place it at the beginning(i.e rotate a portion). Example: input = func([1,2,3,4,5,6,7],3); output = [5,6,7,1,2,3,4]; But on leetcode, output was still [1,2,3,4,5,6,7]. I just need someone to help me run it on their text editor to know what the problem is. https://code.sololearn.com/ct5CI25CbA6T/?ref=app
10 Respuestas
+ 1
output
[ 5,6,7,1,2,3,4]
[ 'c', 'd', 'a', 'b' ]
+ 1
Chris C. Thanks. I really appreciate. I'm getting the same output but the solution keeps getting rejected.
+ 1
Select JavaScript as your document type in the drop down menu.
+ 1
leetcode output
Finished in 88 ms
[
5, 6, 7, 1,
2, 3, 4
]
[ 'c', 'd', 'a', 'b' ]
+ 1
Infinite yes I simply started a new leetcode playground and copied your text from codeplayground and pasted it to leetcode playground. Selected JavaScript and ran the code. It worked.
0
Post the output you get as answers.
0
Chris C. I did, i will try it again. Did you try it on yours?
0
Chris C. Thanks very much. I guess the problem is from my device. This is actually the second time my solution is getting rejected.
0
What do you mean by rejected? Is it throwing an error?
0
Chris C. Not an error, it run's but gives a different output.
https://www.sololearn.com/post/691237/?ref=app