def solution(arr, divisor):
    answer = []
    count = 0
    for i in range(len(arr)):
        if arr[i]%divisor == 0:
            answer.append(arr[i])
            count += 1
            
    if count == 0:
        answer.append(-1)
    return sorted(answer)

 

 

def solution(arr, divisor):
    return sorted([x for x in arr if x%divisor == 0]) or [-1]

+ Recent posts