iteratively generate n-permutations with (n-1)-permutations, O(n^3) and O(n^2)ģ. DFS with swapping, check duplicate, O(n^2) and O(n^2)Ģ. iteratively generate n-permutations with (n-1)-permutations, O(n^3) and O(n^2)ġ. Replace all parentheses with '', if empty then TrueĪdd a dummy head, then merge two sorted list in O(m+n)ģ. Two pointers, first pointer goes to n position, then move both pointers until reach tail, O(n) and O(n)Ģ. Go through list and get length, then remove length-n, O(n) and O(n)Ģ. The same as 3Sum, but we can merge pairs with the same sumġ. Get the len and check left and right with 10^len, 10īackground knowledge Just like 10-digit number, divide and minusĪdd all curr, if curr > prev, then need to subtract 2 * prevġ. Overflow when the result is greater than 2147483647 or less than -2147483648. A palindrome can be expanded from its center An extension of median of two sorted arrays of equal size problemġ. Merge two sorted lists and compute median, O(m + n) and O(m + n)Ģ. Remember the character index and current check pos, if character index >= current pos, then there is duplicateġ. Longest Substring Without Repeating CharactersĢ. Sort and search with two points O(n) and O(1) space. ![]() Check it out, if you are interested in big data and deep learning. I'm currently working on Analytics-Zoo - an unified Data Analytics and AI platform. If you want full study checklist for code & whiteboard interview, please turn to jwasham's coding-interview-university.Īlso, there are open source implementations for basic data structs and algorithms, such as Algorithms in Python and Algorithms in Java. Remember solutions are only solutions to given problems. ![]() Python & JAVA Solutions for Leetcode (inspired by haoel's leetcode)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |