This file contains hidden or 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
| function minimumWindowSubstring(str, substr) { | |
| let lettersSeen = {}; | |
| let lettersNeeded = {}; | |
| let lettersMissing = 0; | |
| for(let i = 0; i < substr.length; i++) { | |
| if(substr[i] in lettersNeeded){ | |
| lettersNeeded[substr[i]] += 1; | |
| } else { | |
| lettersNeeded[substr[i]] = 1; |
This file contains hidden or 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 Organism { | |
| constructor(r, g, b) { | |
| this.r = r; | |
| this.g = g; | |
| this.b = b; | |
| this.mutationSize = 20; //Must be greater than 2 | |
| } | |
| reproduce() { | |
| // Prevents negative numbers from appearing | |
| let newR = Math.max(this.r + this.mutateTrait(), 0); |
This file contains hidden or 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 Organism { | |
| constructor(r, g, b) { | |
| this.r = r; | |
| this.g = g; | |
| this.b = b; | |
| this.mutationSize = 20; //Must be greater than 2 | |
| } | |
| reproduce() { | |
| // Prevents negative numbers from appearing | |
| let newR = Math.max(this.r + this.mutateTrait(), 0); |
This file contains hidden or 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 Environment { | |
| constructor(r, g, b, startingOrganisms) { | |
| this.r = r; | |
| this.g = g; | |
| this.b = b; | |
| this.organisms = []; | |
| this.weaknesses = []; | |
| this.startingOrganisms = startingOrganisms; | |
| this.addOrganisms(this.startingOrganisms); | |
| this.generationTime = 1 |
This file contains hidden or 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 Organism { | |
| constructor(r, g, b) { | |
| this.r = r; | |
| this.g = g; | |
| this.b = b; | |
| this.mutationSize = 10; //Must be greater than 2 | |
| } | |
| reproduce() { | |
| // Prevents negative numbers from appearing | |
| let newR = Math.max(this.r + this.mutateTrait(), 0); |
This file contains hidden or 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 TreeNode { | |
| constructor(val) { | |
| this.val = val; | |
| this.left = null; | |
| this.right = null; | |
| } | |
| } | |
| class BST { | |
| constructor() { |
NewerOlder