Myvideo

Guest

Login

Хитрая задача с собеседования #Python

Uploaded By: Myvideo
26 views
0
0 votes
0

Условие: Дан массив nums, в которой числа из диапазона [1, n]. Необходимо вывести числа из [1, n], которых нет в nums. Код: nums = [4, 3, 2, 7, 8, 2, 3, 1] ch = [0] * len(nums) for el in nums: ch[el-1] = 1 net = [] for n in range(len(ch)): if ch[n] == 0: (n 1) print(net)

Share with your friends

Link:

Embed:

Video Size:

Custom size:

x

Add to Playlist:

Favorites
My Playlist
Watch Later