DDAI - Design data intensive application. #ByteByteGo

What reading do he recommend to understand practically DSA? I follow aslieng. for now.

Points

My First Attempt

  • Improvement points: Can reduce variables
class Solution:
    # two pointer window approach
    # tc: n
 
    def lengthOfLongestSubstring(self, s: str) -> int:
        str_len = len(s)
        max_unique_count = 0
        pointer_one = 0
        pointer_two = 1
        unique_char_map = {}
        unique_char_map[s[0]] = 1
        unique_char_map[s[1]] = 1
        cur_count = 0
 
        for i in range(0, str_len):
            cur_char = s[i]
            if cur_char in unique_char_map:
                pointer_one = pointer_two
                pointer_two += 1
                if cur_count > max_unique_count:
                    max_unique_count = cur_count
                cur_count = 0
            else:
                pointer_two += 1
                cur_count += 1
            
        return max_unique_count