From 9670d3096334b7d4a5846e9fd24bd2b8d8383a4c Mon Sep 17 00:00:00 2001 From: Lanre Adedara Date: Mon, 2 Sep 2024 06:58:17 +0100 Subject: [PATCH] feat: add swift solution2 implementation to lcof2 problem: No.088 --- .../README.md" | 17 +++++++++++++++++ .../Solution2.swift" | 12 ++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 "lcof2/\345\211\221\346\214\207 Offer II 088. \347\210\254\346\245\274\346\242\257\347\232\204\346\234\200\345\260\221\346\210\220\346\234\254/Solution2.swift" diff --git "a/lcof2/\345\211\221\346\214\207 Offer II 088. \347\210\254\346\245\274\346\242\257\347\232\204\346\234\200\345\260\221\346\210\220\346\234\254/README.md" "b/lcof2/\345\211\221\346\214\207 Offer II 088. \347\210\254\346\245\274\346\242\257\347\232\204\346\234\200\345\260\221\346\210\220\346\234\254/README.md" index 264a9af2e50c6..939f08d17f275 100644 --- "a/lcof2/\345\211\221\346\214\207 Offer II 088. \347\210\254\346\245\274\346\242\257\347\232\204\346\234\200\345\260\221\346\210\220\346\234\254/README.md" +++ "b/lcof2/\345\211\221\346\214\207 Offer II 088. \347\210\254\346\245\274\346\242\257\347\232\204\346\234\200\345\260\221\346\210\220\346\234\254/README.md" @@ -235,6 +235,23 @@ function minCostClimbingStairs(cost: number[]): number { } ``` +#### Swift + +```swift +class Solution { + func minCostClimbingStairs(_ cost: [Int]) -> Int { + var a = 0 + var b = 0 + for i in 1.. diff --git "a/lcof2/\345\211\221\346\214\207 Offer II 088. \347\210\254\346\245\274\346\242\257\347\232\204\346\234\200\345\260\221\346\210\220\346\234\254/Solution2.swift" "b/lcof2/\345\211\221\346\214\207 Offer II 088. \347\210\254\346\245\274\346\242\257\347\232\204\346\234\200\345\260\221\346\210\220\346\234\254/Solution2.swift" new file mode 100644 index 0000000000000..c8c37db6d9938 --- /dev/null +++ "b/lcof2/\345\211\221\346\214\207 Offer II 088. \347\210\254\346\245\274\346\242\257\347\232\204\346\234\200\345\260\221\346\210\220\346\234\254/Solution2.swift" @@ -0,0 +1,12 @@ +class Solution { + func minCostClimbingStairs(_ cost: [Int]) -> Int { + var a = 0 + var b = 0 + for i in 1..