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 UnionFind { | |
public int[] rank; | |
public int[] parent; | |
public int n; | |
public UnionFind(int n){ | |
this.n = n; | |
rank = new int[n]; | |
parent = new int[n]; | |
for(int i = 0 ; i < n ; i++) |
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 Button extends React.Component { | |
state = {counter : 0}; | |
changeLabel = () => { | |
this.setState({ | |
counter: this.state.counter + 1 | |
}) | |
} | |
render() { |
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
const Card = (props) => { | |
return( | |
<div style={{margin : '1em'}}> | |
<img width ='75' src={props.avatar_url} /> | |
<div style={{display : 'inline-block', marginLeft : 10}}> | |
<div style={{fontSize : '1.25em', fontWeight : 'bold'}}>{props.name}</div> | |
<div>{props.company}</div> | |
</div> | |
</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
from collections import defaultdict | |
from collections import deque | |
# Definition for a binary tree node. | |
# class TreeNode: | |
# def __init__(self, x): | |
# self.val = x | |
# self.left = None | |
# self.right = None |
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
/** | |
* Definition for a binary tree node. | |
* public class TreeNode { | |
* int val; | |
* TreeNode left; | |
* TreeNode right; | |
* TreeNode(int x) { val = x; } | |
* } | |
*/ | |
class Solution { |
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 Solution { | |
public int subarraySum(int[] nums, int k) { | |
int sum = 0; | |
int result = 0; | |
HashMap<Integer, Integer> prevSum = new HashMap<Integer, Integer>(); | |
prevSum.put(0, 1); | |
for(int i = 0 ; i < nums.length ; i++) { | |
sum += nums[i]; | |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.min.js"></script> | |
<title>JS Bin</title> | |
</head> | |
<body> |