Skip to content

Commit 4a05bd5

Browse files
yanglbmeidoocs
authored andcommitted
style: format code and docs with prettier
1 parent a4521de commit 4a05bd5

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

lcof/面试题49. 丑数/README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -245,11 +245,11 @@ class Solution {
245245
var vis = Set<Int64>()
246246
var pq = PriorityQueue<Int64>()
247247
let factors: [Int64] = [2, 3, 5]
248-
248+
249249
pq.push(1)
250250
vis.insert(1)
251251
var ans: Int64 = 0
252-
252+
253253
for _ in 0..<n {
254254
ans = pq.pop()!
255255
for factor in factors {
@@ -259,23 +259,23 @@ class Solution {
259259
}
260260
}
261261
}
262-
262+
263263
return Int(ans)
264264
}
265265
}
266266

267267
struct PriorityQueue<T: Comparable> {
268268
private var heap: [T] = []
269-
269+
270270
var isEmpty: Bool {
271271
return heap.isEmpty
272272
}
273-
273+
274274
mutating func push(_ element: T) {
275275
heap.append(element)
276276
heapifyUp(from: heap.count - 1)
277277
}
278-
278+
279279
mutating func pop() -> T? {
280280
guard !heap.isEmpty else {
281281
return nil
@@ -288,7 +288,7 @@ struct PriorityQueue<T: Comparable> {
288288
heapifyDown(from: 0)
289289
return value
290290
}
291-
291+
292292
private mutating func heapifyUp(from index: Int) {
293293
var index = index
294294
let element = heap[index]
@@ -302,7 +302,7 @@ struct PriorityQueue<T: Comparable> {
302302
}
303303
heap[index] = element
304304
}
305-
305+
306306
private mutating func heapifyDown(from index: Int) {
307307
var index = index
308308
let element = heap[index]

0 commit comments

Comments
 (0)