From b71747e432f309828ee131619150c10ce68b4db9 Mon Sep 17 00:00:00 2001 From: Lanre Adedara Date: Tue, 3 Sep 2024 07:43:08 +0100 Subject: [PATCH] feat: add swift implementation to lcof2 problem: No.093 --- .../README.md" | 29 +++++++++++++++++++ .../Solution.swift" | 24 +++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 "lcof2/\345\211\221\346\214\207 Offer II 093. \346\234\200\351\225\277\346\226\220\346\263\242\351\202\243\345\245\221\346\225\260\345\210\227/Solution.swift" diff --git "a/lcof2/\345\211\221\346\214\207 Offer II 093. \346\234\200\351\225\277\346\226\220\346\263\242\351\202\243\345\245\221\346\225\260\345\210\227/README.md" "b/lcof2/\345\211\221\346\214\207 Offer II 093. \346\234\200\351\225\277\346\226\220\346\263\242\351\202\243\345\245\221\346\225\260\345\210\227/README.md" index 7bece72ba906c..14fb67e2ab339 100644 --- "a/lcof2/\345\211\221\346\214\207 Offer II 093. \346\234\200\351\225\277\346\226\220\346\263\242\351\202\243\345\245\221\346\225\260\345\210\227/README.md" +++ "b/lcof2/\345\211\221\346\214\207 Offer II 093. \346\234\200\351\225\277\346\226\220\346\263\242\351\202\243\345\245\221\346\225\260\345\210\227/README.md" @@ -188,6 +188,35 @@ func lenLongestFibSubseq(arr []int) int { } ``` +#### Swift + +```swift +class Solution { + func lenLongestFibSubseq(_ arr: [Int]) -> Int { + let n = arr.count + var mp = [Int: Int]() + for i in 0.. 2 ? ans : 0 + } +} +``` + diff --git "a/lcof2/\345\211\221\346\214\207 Offer II 093. \346\234\200\351\225\277\346\226\220\346\263\242\351\202\243\345\245\221\346\225\260\345\210\227/Solution.swift" "b/lcof2/\345\211\221\346\214\207 Offer II 093. \346\234\200\351\225\277\346\226\220\346\263\242\351\202\243\345\245\221\346\225\260\345\210\227/Solution.swift" new file mode 100644 index 0000000000000..4149dafe4b8c2 --- /dev/null +++ "b/lcof2/\345\211\221\346\214\207 Offer II 093. \346\234\200\351\225\277\346\226\220\346\263\242\351\202\243\345\245\221\346\225\260\345\210\227/Solution.swift" @@ -0,0 +1,24 @@ +class Solution { + func lenLongestFibSubseq(_ arr: [Int]) -> Int { + let n = arr.count + var mp = [Int: Int]() + for i in 0.. 2 ? ans : 0 + } +} \ No newline at end of file