You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: solution/0400-0499/0412.Fizz Buzz/README_EN.md
+46-26
Original file line number
Diff line number
Diff line change
@@ -51,7 +51,11 @@ tags:
51
51
52
52
<!-- solution:start -->
53
53
54
-
### Solution 1
54
+
### Solution 1: Simulation
55
+
56
+
We iterate through each integer from 1 to $n$. For each integer, we check whether it is a multiple of both 3 and 5, or just a multiple of 3, or just a multiple of 5. Based on the check result, we add the corresponding string to the answer array.
57
+
58
+
The time complexity is $O(n)$, where $n$ is the integer given in the problem. Ignoring the space consumption of the answer array, the space complexity is $O(1)$.
0 commit comments