Google Coding Interview Question - Reorder List - LeetCode 143

preview_player
Показать описание


Step by step walk through of the solution to the popular Google coding interview question, Reorder List .

LeetCode 143

0:00 Intro
0:22 Explanation
5:16 Code

#softwareengineering #javascript #leetcode
Рекомендации по теме
Комментарии
Автор

this is the most confusing problem on linked lists I have seen

gomeztorricellygomez
Автор

l=[]
n=int(input("enter no of elements do you want"))
for i in range (0, n):
b=int(input("num:"))
l.append(b)
print(l)
l2=[]
if(len(l)%2==0):
for i in range(0, len(l)//2):
l2.append(l[i])
l2.append(l[-i-1])
else:
for j in range(0, (len(l)+1)//2):
l2.append(l[j])
l2.append(l[-j-1])
print(l2)

brother i am getting an extra element while i am printing the odd number of elements please rectify this code and give me the

durden..

venkateshk
visit shbcf.ru