#
# 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
#
#
# @param students int整型一维数组
# @param sandwiches int整型一维数组
# @return int整型
#
class Solution:
def countStudents(self, students: List[int], sandwiches: List[int]) -> int:
# write code here
k = 0
while sandwiches:
if students[0] == sandwiches[0]:
students.pop(0)
sandwiches.pop(0)
k = 0
else:
students.append(students.pop(0))
k += 1
if k == len(sandwiches):
break
return k

京公网安备 11010502036488号