+ 2
How to Make this Code Be coorect in All Test Cases
I was on hackerEarth trying to solve a coding challenge but the code is only correct for the first Test Case Code: https://code.sololearn.com/cDvx4eYiXddG/?ref=app Link To Challenge: https://www.hackerearth.com/practice/codemonk/
3 Answers
+ 3
MATOVU CALEB
I'm not exactly sure after running
5
9 7
2 4 6 8 1 3 5 7 9
result # 6 8 1 3 7 9 2 4
SoloProg i got the same answer but your code threw an error out of range on
N, K = map(int,input().split())
+ 3
BroFar
5# is the number of test cases to be used by the hackerEarth ide
9#number of elements that will make up the array
7# refers to how many items the last element will be rotated to the right direct
+ 2
# (ââ _â ) Keep learning & happy coding :D
T = int(input())
for t in range(T):
N, K = map(int,input().split())
Idx = N-(K%N)
arr = list( map(int, input().strip().split()) )[:N]
A = []
for i in range(Idx, N):
A.append(str(arr[i]))
for i in range(Idx):
A.append(str(arr[i]))
arr = A
print(" ".join(arr))