Description: Solution: In this problem, we are gonna compare the end of the previous interval to the start of the current interval. If the new start point is bigger than prevEnd, we don't count. Else, it is overlapping, so that we count them as 1. And update prevEnd. Since, new intervals are still overlapping, we should use the min(end, prevEnd). Time Complexity: O(nlogn)
Description: Solution: In for loop, we have two parts: odd number length & even number length. In odd number case, we expand our l & r pointers to both sides, and get the number of palindromic. In even number case, we do same thing, but l & r pointer starts with different location. (i, i+1)
Description: Solution: Brute Force --> time complexity will be O(n^3). However, it takes a lot of time. Instead of Brute Force, we are gonna set left & right pointer for the string. In the for loop, we are gonna check if the string is odd number length or not. We keep update the resLen, and make sure it should be bigger than previous resLen. In odd number case, l & r starts from s[0]. We keep mo..
Description: Solution: Let's make left pointer & right pointer. isalnum() makes sure the char is whether char or not. If one of those is not char, then we move the pointer. Space Complexity: O(1)
Description: Solution: In pariHash, we set close parentheses as a key, and open parentheses as a value. If the c is open parentheses, we append on stack. If the c is closing parentheses, we search the last value of stack "stack[-1]" and compare it with its key. We can pop the stack. If the stack is empty at the end of the solution, we can return True. Time Complexity: O(n) Space Complexity: O(n)
Description: Solution: We use hashtable for this problem. In hashtable, the key is the sorted value(ex. aet, ant, abt in example 1) if keyString is not the key in table, we make the new list for it. Then, we append s to the appropriate key. Time Complexity: O(m*nlogn) Space Complexity: O(n)