We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7b47149 commit 34a5074Copy full SHA for 34a5074
String/CountAndSay.swift
@@ -1,11 +1,8 @@
1
/**
2
* Question Link: https://leetcode.com/problems/count-and-say/
3
- * Primary idea: Recursive iteration, use outer iteration to count times,
4
- * use inner iteration to get the right string for specific index
+ * Primary idea: Recursion to get previous string, then iterate and generate current one.
5
*
6
- * Note: Swift does not have a way to access a character in a string with O(1),
7
- * thus we have to first transfer the string to a character array
8
- * Time Complexity: O(n^2), Space Complexity: O(n)
+ * Time Complexity: O(n^2), Space Complexity: O(1)
9
10
*/
11
0 commit comments