We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
import math
import os
import random
import re
import sys
if name == 'main':
t = int(input().strip())
for i in range(t):
first_multiple_input = input().rstrip().split()
n = int(first_multiple_input[0])
k = int(first_multiple_input[1])
L = []
L1 = []
for i in range(n):
L.append(i)
l = 0
r = n-1
while l<r:
L1.append(L[r])
L1.append(L[l])
l += 1
r -= 1
if l == r:
L1.append(L[l])
print(L1.index(k))
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Reverse Game
You are viewing a single comment's thread. Return to all comments →
!/bin/python3
import math import os import random import re import sys
if name == 'main': t = int(input().strip())