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 4b608d3 commit ed9860fCopy full SHA for ed9860f
Python/remove-comments.py
@@ -1,5 +1,5 @@
1
# Time: O(n), n is the length of the source
2
-# Space: O(k), k is the max length of a line.
+# Space: O(k), k is the max length of a line
3
4
# Given a C++ program, remove comments from it.
5
# The program source is an array where source[i] is the i-th line of the source code.
@@ -87,11 +87,11 @@ def removeComments(self, source):
87
:rtype: List[str]
88
"""
89
in_block = False
90
- result = []
+ result, newline = [], []
91
for line in source:
92
- i = 0
93
if not in_block:
94
newline = []
+ i = 0
95
while i < len(line):
96
if not in_block and i+1 < len(line) and line[i:i+2] == '/*':
97
in_block = True
0 commit comments