Adding Hashing-2 solutions (All 3)#2178
Conversation
Subarray Sum Equals K (W2_5_560_subarray_sum_equals_k.py)
VERDICT: PASS Contiguous Binary Subarray (W2_4_525_contiguous_array.py)Your solution is excellent! It correctly implements the algorithm and has optimal time and space complexity. Here are a few minor suggestions for improvement:
Overall, great job! Your solution is efficient and clear. VERDICT: PASS Longest Palindrome in a string (W2_3_409_longest_palindrome.py)Your solution is excellent! It correctly implements the algorithm and has optimal time and space complexity. Here are a few minor suggestions to enhance code quality:
Here's a slightly revised version of your code with these suggestions: class Solution:
def longestPalindrome(self, s: str) -> int:
odd_chars = set()
count = 0
for ch in s:
if ch in odd_chars:
count += 2
odd_chars.remove(ch)
else:
odd_chars.add(ch)
if odd_chars:
count += 1
return countOverall, great job! Your solution is efficient and correct. VERDICT: PASS |
Problem 1 - W2_5_560_subarray_sum_equals_k.py
Problem 2 - W2_4_525_contiguous_array.py
Problem 3 - W2_3_409_longest_palindrome.py