style: update comment format

This commit is contained in:
nuomi1
2023-01-08 20:53:24 +08:00
parent 7556558704
commit 3b52df2a8f
7 changed files with 55 additions and 54 deletions

View File

@@ -6,14 +6,14 @@
import utils
//
/* */
@discardableResult
func function() -> Int {
// do something
return 0
}
//
/* */
func constant(n: Int) {
// O(1)
let a = 0
@@ -30,7 +30,7 @@ func constant(n: Int) {
}
}
// 线
/* 线 */
func linear(n: Int) {
// n O(n)
let nums = Array(repeating: 0, count: n)
@@ -40,7 +40,7 @@ func linear(n: Int) {
let map = Dictionary(uniqueKeysWithValues: (0 ..< n).map { ($0, "\($0)") })
}
// 线
/* 线 */
func linearRecur(n: Int) {
print("递归 n = \(n)")
if n == 1 {
@@ -49,13 +49,13 @@ func linearRecur(n: Int) {
linearRecur(n: n - 1)
}
//
/* */
func quadratic(n: Int) {
// O(n^2)
let numList = Array(repeating: Array(repeating: 0, count: n), count: n)
}
//
/* */
@discardableResult
func quadraticRecur(n: Int) -> Int {
if n <= 0 {
@@ -67,7 +67,7 @@ func quadraticRecur(n: Int) -> Int {
return quadraticRecur(n: n - 1)
}
//
/* */
func buildTree(n: Int) -> TreeNode? {
if n == 0 {
return nil
@@ -80,7 +80,7 @@ func buildTree(n: Int) -> TreeNode? {
@main
enum SpaceComplexity {
// Driver Code
/* Driver Code */
static func main() {
let n = 5
//