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 bst { | |
constructor(val) { | |
this.value = val; | |
this.left = null; | |
this.right = null; | |
} | |
insert(val) { | |
if (val < this.value) { | |
if(this.left === null) this.left = new bst(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
const { Client } = require('pg'); | |
var config = { | |
user: 'michaeldimitras', // env var: PGUSER | |
database: 'reviews', // env var: PGDATABASE | |
password: null, // env var: PGPASSWORD | |
port: 5432, // env var: PGPORT | |
} | |
const client = new Client(config); |
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
["accelerator", "accordion", "account", "accountant", "acknowledgment", "acoustic", "acrylic", "act", "action", "active", "activity", "actor", "actress", "adapter", "addition", "address", "adjustment", "adult", "advantage", "advertisement", "advice", "afghanistan", "africa", "aftermath", "afternoon", "aftershave", "afterthought", "age", "agenda", "agreement", "air", "airbus", "airmail", "airplane", "airport", "airship", "alarm", "albatross", "alcohol", "algebra", "algeria", "alibi", "alley", "alligator", "alloy", "almanac", "alphabet", "alto", "aluminium", "aluminum", "ambulance", "america", "amount", "amusement", "anatomy", "anethesiologist", "anger", "angle", "angora", "animal", "anime", "ankle", "answer", "ant", "antarctica", "anteater", "antelope", "anthony", "anthropology", "apartment", "apology", "apparatus", "apparel", "appeal", "appendix", "apple", "appliance", "approval", "april", "aquarius", "arch", "archaeology", "archeology", "archer", "architecture", "area", "argentina", "argument", "aries", "ari |
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. | |
* function TreeNode(val) { | |
* this.val = val; | |
* this.left = this.right = null; | |
* } | |
*/ | |
/** | |
* @param {TreeNode} root | |
* @param {number} k |
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
muncheez=# SELECT * FROM restaurants WHERE id=0; | |
id | name | address | url | phone | hours | lat | long | |
----+--------------+-----------------+---------------------+--------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------+---------- | |
0 | Magenta Coke | 2482 Marco Burg | https://haylee.info | 541-917-8798 | Monday: 9:00 AM – 9:00 PM, Tuesday: 9:00 AM – 9:00 PM, Wednesday: 9:00 AM – 9:00 PM, Thursday: 9:00 AM – 9:00 PM, Friday: 9:00 AM – 9:00 PM, Saturday: 9:00 AM – 9:00 PM, Sunday: 9:00 AM – 9:00 PM | -33.5837 | -146.592 | |
(1 row) | |
muncheez=# SELECT * FROM restaurants WHERE name='Magenta Coke'; | |
id | nam |
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
/* | |
* A function that takes an array of lowercase characters and returns | |
* an array in which all of the vowels are repeated. | |
* Time complexity: O(n) | |
* Space complexity: O(1) | |
*/ | |
const vowelDoubler = function(arr) { | |
let numVowels = 0; | |
const vowels = new Set(['a', 'e', 'i', 'o', 'u']); | |
for(let i = 0; i < arr.length; 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 messageBus { | |
constructor() { | |
this.subscribers = {}; | |
} | |
subscribe(topic, cb) { | |
if (this.subscribers[topic]) { | |
this.subscribers[topic].push(cb) | |
} else { | |
this.subscribers[topic] = [cb]; |
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
var frequencySort = function(s) { | |
let charCounts = {}; | |
for(let i = 0; i < s.length; i++) { | |
if(charCounts[s[i]]) { | |
charCounts[s[i]] += 1; | |
} else { | |
charCounts[s[i]] = 1; | |
} |
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
/** | |
* @param {string} s | |
* @param {string} t | |
* @return {boolean} | |
*/ | |
var isSubsequence = function(s, t) { | |
if(!s.length) { | |
return true; | |
} | |
let threads = []; |
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
/** | |
* @param {number} capacity | |
*/ | |
var LFUCache = function(capacity) { | |
this.capacity = capacity; | |
this.storage = {}; | |
}; | |
/** | |
* @param {number} key |
OlderNewer