Skip to content

Instantly share code, notes, and snippets.

@koher
Created June 13, 2021 14:03
Show Gist options
  • Save koher/696ebeb632e35bc49def09a69e728c3c to your computer and use it in GitHub Desktop.
Save koher/696ebeb632e35bc49def09a69e728c3c to your computer and use it in GitHub Desktop.
let aa = (1...100).shuffled().dropFirst(50).sorted()
print(aa.count, 100)
print(aa.map(\.description).joined(separator: " "))
let aaSet = Set(aa)
var count = 0
var ans: [Int] = []
for i in 1 ... 1000 {
if aaSet.contains(i) { continue }
count += 1
print(count)
ans.append(i)
if ans.count == 100 { break }
}
print()
for x in ans {
print(x)
}
50 100
1 2 4 5 6 7 11 12 13 14 18 22 23 27 28 29 34 35 36 37 39 42 43 44 45 46 47 50 54 55 58 59 62 63 65 72 73 74 76 78 80 81 84 87 88 90 91 93 94 98
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
3
8
9
10
15
16
17
19
20
21
24
25
26
30
31
32
33
38
40
41
48
49
51
52
53
56
57
60
61
64
66
67
68
69
70
71
75
77
79
82
83
85
86
89
92
95
96
97
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment