Skip to content

Commit 5a99c68

Browse files
committed
fix: max 함수를 사용한 코드 개선
1 parent 2fc1dda commit 5a99c68

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

  • longest-substring-without-repeating-characters

longest-substring-without-repeating-characters/gyeo-ri.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ def lengthOfLongestSubstring(self, s: str) -> int:
1010
start_idx += 1
1111

1212
used_characters.add(s[end_idx])
13-
current_length = end_idx - start_idx + 1
14-
if current_length > longest_length:
15-
longest_length = current_length
13+
longest_length = max(longest_length, end_idx - start_idx + 1)
1614

1715
return longest_length
1816

0 commit comments

Comments
 (0)