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 Cache { | |
| constructor() { | |
| this.theCache = {} | |
| } | |
| setImageById(id, image) { | |
| let numberOfImages = Object.keys(this.cache).length | |
| if (numberOfImages > 50) { | |
| let keyOfOldest; | |
| for(key in this.theCache) { | |
| if (!keyOfOldest) { |
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 findMinFromTree(node) { | |
| let minValue = node.value | |
| let minArray = [minValue] | |
| -------------------------------------------------------------- | |
| if (node.left) { | |
| minArray.concat(findMinFromTree(node.left)) | |
| } | |
| if (node.right) { |
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
| public class Node { | |
| Node next; | |
| object val; | |
| public Node(object val) { | |
| this.val = val | |
| } | |
| } | |
| public class LinkedList { | |