This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hypertext Markup Language (HTML) | |
standard markup language for creating web pages and web applications. | |
With Cascading Style Sheets (CSS) and JavaScript,for the World Wide Web. | |
1. DOM | |
1.1 Element P, DIV, A, TABLE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TrieNode { | |
char ch; | |
Map<Character, TrieNode> children= new HashMap<>(); | |
boolean isWord; | |
} | |
class TrieHashMap{ | |
TrieNode root= new TrieNode(); | |
//O(k) k= length of word |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package basic; | |
import java.util.Iterator; | |
import java.util.LinkedList; | |
import java.util.Stack; | |
import java.util.Vector; | |
import basic.graph.Graph; | |
public class graph { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
swap | |
832. Flipping an Image | |
https://leetcode.com/problems/flipping-an-image/description/ | |
Input: [[1,1,0],[1,0,1],[0,0,0]] | |
Output: [[1,0,0],[0,1,0],[1,1,1]] | |
class Solution(object): | |
def flipAndInvertImage(self, A): | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. sort(key=len, reverse=True) | |
example | |
input: ["apple", "pear", "a","long", "longisland"] | |
output: ['longisland', 'apple', 'pear', 'long', 'a'] | |
problem: 294 | |
2. zip(*iterables) | |
words= ["apple", "pear", "he", "longisland"] | |
for letters in zip(*words): | |
for letters in zip("apple", "pear", "he", "longisland"): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88. Merge Sorted Array | |
https://leetcode.com/problems/merge-sorted-array/description/ | |
Input: | |
nums1 = [1,2,3,0,0,0], m = 3 | |
nums2 = [2,5,6], n = 3 | |
Output: [1,2,2,3,5,6] | |
class Solution(object): | |
def merge(self, nums1, m, nums2, n): | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
516. Longest Palindromic Subsequence | |
https://leetcode.com/problems/longest-palindromic-subsequence/ | |
https://www.youtube.com/watch?v=v8irqkTcJ6s | |
Given a string s, find the longest palindromic subsequence's length in s. You may assume that the maximum length of s is 1000. | |
Example 1: | |
Input: | |
"bbbab" | |
Output: | |
4 | |
One possible longest palindromic subsequence is "bbbb". |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
237. Delete Node in a Linked List | |
https://leetcode.com/problems/delete-node-in-a-linked-list/description/ | |
class Solution(object): | |
def deleteNode(self, node): | |
""" | |
:type node: ListNode | |
:rtype: void Do not return anything, modify node in-place instead. | |
""" | |
if not node: return | |
node.val= node.next.val |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
973. K Closest Points to Origin | |
https://leetcode.com/problems/k-closest-points-to-origin/ | |
We have a list of points on the plane. Find the K closest points to the origin (0, 0). | |
(Here, the distance between two points on a plane is the Euclidean distance.) | |
You may return the answer in any order. The answer is guaranteed to be unique (except for the order that it is in.) | |
Example 1: | |
Input: points = [[1,3],[-2,2]], K = 1 | |
Output: [[-2,2]] | |
Explanation: | |
The distance between (1, 3) and the origin is sqrt(10). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Separate chaining | |
linked lists of values | |
* search time complexity: logn | |
2. Open addressing | |
Insert(k): Keep probing until an empty slot is found. Once an empty slot is found, insert k. | |
Search(k): Keep probing until slot’s key doesn’t become equal to k or an empty slot is reached. | |
* linear probing | |