题解 | #牛的品种排序II#
牛的品种排序II
https://www.nowcoder.com/practice/43e49fbb98b4497ba46e185918188b1c
#
# 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
#
#
# @param cows int整型一维数组
# @return int整型一维数组
#
class Solution:
def sortCows(self , cows: List[int]) -> List[int]:
# write code here
a,b,c= [],[],[]
for i in cows:
if i == 0:
a.append(i)
if i == 1:
b.append(i)
if i == 2:
c.append(i)
return a+b+c


查看3道真题和解析