Skip to content

Instantly share code, notes, and snippets.

@taixingbi
taixingbi / index.html
Created April 24, 2020 12:38
OpenCV.js Video Processing
<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>
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
We couldn’t find that file to show.
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);
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
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;
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---------------
https://leetcode.com/problems/subsets/discuss/27281/A-general-approach-to-backtracking-questions-in-Java-(Subsets-Permutations-Combination-Sum-Palindrome-Partitioning)
subsets
permutations
high-level, interpreted programming language