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
""" | |
DFS | |
iterate from 0 to 9, and dfs from the source | |
dfs will take in a source, N, and the adjacencylist, and keeping track of the result | |
Base Case: if N == 0 | |
Recursion: for child in src: dfs(child, N - 1, res) | |
NOTE: if source is 5, will not break dfs but will instead not go into for loop. (line 23) | |
Time: O(3^n) since every worst case, number 4 and number 6 has 3 children, and we need to visit all combinations |
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
""" | |
DFS | |
iterate from 0 to 9, and dfs from the source | |
dfs will take in a source, N, and the adjacencylist, and keeping track of the result | |
Base Case: if N == 0 | |
Recursion: for child in src: dfs(child, N - 1, res) | |
NOTE: if source is 5, will not break dfs but will instead not go into for loop. (line 23) | |
Time: O(3^n) since every worst case, number 4 and number 6 has 3 children, and we need to visit all combinations |
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
""" | |
Two lists as the input. List1: stores word pairs with the same meaning, such as [(big, large), (fast, quick)]; | |
List2: stores query pairs, such as [(grass is green, tree is green), (cat is fast, cat is quick)]. | |
Based list1 , figure out if each pair of queries in list2 mean the same thing. | |
""" | |
""" | |
Union find | |
For every pair, put them inside the same disjoint set |
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
#Subproblem: fewest number of coins to reach amount i | |
# subprobs: amount | |
#recurrence: dp[i] = min(dp[i - coin] + 1) for coin in coins | |
# runtime: O(coins) | |
# topsort : 0 to amount | |
# solution: dp[amount] | |
# TIME: O(amount * coins) | |
# SPACE: O(amount) |
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
def union(x,y, edges): | |
rep = [-1] * sizeOfGraph | |
for edge in edges: | |
x_rep, y_rep = find(x, rep), find_set(y, rep) | |
if x_rep == y_rep: | |
return True | |
return False | |
def find(node, rep): | |
#rep |
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
import React from 'react'; | |
import PropTypes from 'prop-types'; | |
import PositionSection from '../../components/Position/PositionSection'; | |
import color from '../../layouts/color.module.css'; | |
const positionSubSectionListToRender = (positionList) => { | |
const sectionsInOrder = ['Business and Ops', 'Design', 'Engineering', 'Product']; | |
return sectionsInOrder |
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
import React from 'react'; | |
import PropTypes from 'prop-types'; | |
import marked from 'marked'; | |
import { TRIBALSCALE_STREET_ADDRESS } from '../utils/constants'; | |
import font from '../layouts/font.module.css'; | |
import color from '../layouts/color.module.css'; | |
import styles from './privacy.module.css'; |
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
@import '../../layouts/base.css'; | |
/* column format */ | |
.columnContainer { | |
max-width: 31.67701863%; | |
width: 100%; | |
} | |
.columnBackgroundImage { | |
max-width: 100%; |
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
import React from 'react'; | |
import PropTypes from 'prop-types'; | |
import color from '../../layouts/color.module.css'; | |
import animations from '../../layouts/animations.module.css'; | |
import styles from './ventureStudiosTilesLayout.module.css'; | |
const { | |
layoutContainer, | |
tileContainer, |
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
''' | |
BRUTE FORCE: | |
iterate through each point, label p1=(x1,y1) ------------------------------ O(n) | |
iterate through next point, label p2 = (x2,y2) -------------------------- O(n) | |
iterate through remaining points, check if (x1,y2) and (x2, y1) exist-- O(n^2) | |
F: IGNORE | |
T: Compare to min_area, update accordingly: | |
area == min_area: add to list min_rects | |
area < min_area: min_area = area, replace min_rects | |
area > min_area: IGNORE |
OlderNewer