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
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> | |
<body> | |
<div id="container"> | |
<table cellpadding="0" cellspacing="0" width="100%" border="0"> | |
<tr> | |
<td></td> | |
<td> | |
<div class="text-center"> | |
<span>Current Filter: </span><span id="filterName">Pass Through</span> | |
</div> |
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
asd |
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 unionFindSet { | |
int[] parents; | |
unionFindSet(int n){ | |
parents= new int[n]; | |
for(int i=0; i<n; i++) | |
parents[i]= i; | |
} | |
//log(n) | |
//path compression |
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
155. Min Stack | |
Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. | |
push(x) -- Push element x onto stack. | |
pop() -- Removes the element on top of the stack. | |
top() -- Get the top element. | |
getMin() -- Retrieve the minimum element in the stack. | |
Example: | |
MinStack minStack = new MinStack(); | |
minStack.push(-2); |
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
LIFO: Last In First Out | |
The last item added would be the first to be removed | |
Push: place a new item at the top of the stack | |
Pop: remove the next item from the top of the stack | |
* Array | |
a series of objects all of which are the same size and type | |
* linked list |
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
O( logn ) | |
* find a number | |
private int binarySearch(int [] array, int key){ | |
int l= 0; | |
int r= array.length-1; | |
int m; | |
while(l<=r){ | |
m= (l+r)/2; |
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/submissions/ | |
class Solution(object): | |
def kClosest(self, points, K): | |
""" | |
:type points: List[List[int]] | |
:type K: int | |
:rtype: List[List[int]] | |
""" | |
#------------------priority queue--------------- |
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
https://leetcode.com/problems/subsets/discuss/27281/A-general-approach-to-backtracking-questions-in-Java-(Subsets-Permutations-Combination-Sum-Palindrome-Partitioning) | |
subsets | |
permutations | |
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
high-level, interpreted programming language | |
NewerOlder