- mapping where keys are tuples (row_index, col_index) ex. ('Alice', 'Math'): 95 2. // : 10//3 = 1 use defaultdict(set) col,row,square, board[r][c] check if in return false trick: square(r//3,c//3)
store it as 4#love, decode: Find the position of the '#' symbol, Get the length of the substring before the '#' symbol,Extract the substring with the given length, Add the substring to the list of decoded strings, Update the index 'i' to the position after the current substring
two ways to solve, 1. reverse array and compare O(n) memory, 2. checkm alphanum lower and two pointer l+=1 r-=1 compare O(1) memory
l, r = 0, len(s) -1, 2. add num l + r compare target two ways to solve 1. for loop O(n^2) -> brute force, 2.two pointer -> optimal solution
- nums.sort() 2. while l < r and the value doesn't contain same value as next one
- l, r = 0, len(s) -1, 2. check min(l,r) * (r-l), use max(res, the value from min) to compare
