ソースを参照

Add complexity analysis

Snow 8 年 前
コミット
8ebf3fcca3
1 ファイル変更4 行追加0 行削除
  1. 4 0
      arrays-and-strings/longest_substring.py

+ 4 - 0
arrays-and-strings/longest_substring.py

@@ -1,4 +1,8 @@
 # Given a string, find the length of the longest substring without repeating characters.
+# Time complexity: worst O(n^2), best O(n). Using hash table to check unique
+# reduces to always O(n^2)
+# Space complexity: O(n/2)
+
 import pytest
 
 def test_longest_substring():