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 Node { | |
constructor(val){ | |
this.val = val; | |
this.next = null | |
} | |
} | |
class SinglyLinkedList{ | |
constructor(){ | |
this.length = 0; |
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 Node { | |
constructor(val){ | |
this.val = val; | |
this.next = null; | |
} | |
} | |
class Stack { | |
constructor(){ | |
this.first = null; |
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 Node { | |
constructor(val) { | |
this.val = val; | |
this.next = null | |
} | |
} | |
class Queue { | |
constructor(){ | |
this.first = null; |
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 Node { | |
constructor(key, value) { | |
this.key = key; | |
this.value = value; | |
this.next = null; | |
this.prev = null; | |
} | |
} | |
class LRUCache { |
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 MinBinaryHeap { | |
constructor() { | |
this.values = [] | |
} | |
insert(val) { | |
this.values.push(val) | |
//first element in the heap |
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 Queue { | |
constructor() { | |
this.pushStack = new Stack(); | |
this.popStack = new Stack(); | |
this.size = 0; | |
} | |
enqueue(val) { | |
this.pushStack.push(val); | |
this.size = this.pushStack.length + this.popStack.length; |
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 Node { | |
constructor(val){ | |
this.val = val; | |
this.next = null | |
} | |
} | |
class SinglyLinkedList{ | |
constructor(){ | |
this.length = 0; |
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 Node { | |
constructor(val){ | |
this.val = val; | |
this.next = null; | |
} | |
} | |
class ItemStack { | |
constructor(){ | |
this.first = null; |
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 Node { | |
constructor(val) { | |
this.val = val; | |
this.next = null; | |
} | |
} | |
class Stack { | |
constructor() { |
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[]} nums | |
* @param {number} target | |
* @return {number[]} | |
*/ | |
var twoSum = function(nums, target) { | |
let lookUp = {} | |
for(let i = 0; i < nums.length; i++) { |
OlderNewer