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
/* Container With Most Water | |
* | |
* @param {number[]} height | |
* @return {number} | |
* | |
* Input: height = [1,8,6,2,5,4,8,3,7] | |
* Output: 49 | |
* Explanation: The above vertical lines are represented by array [1,8,6,2,5,4,8,3,7]. In this case, the max area of water (blue section) the container can contain is 49. | |
*/ |
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
/* Implement Least Recently Used Cache | |
* Improvements to make | |
* 2. Invalidate only a specific node when there is no read/write on that node for a certain duration. | |
*/ | |
/* Node that represents item of a doubly linked list */ | |
class Node { | |
constructor(key, value, previous = null, next = null) { | |
this.key = key; | |
this.value = value; |
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
#!/usr/bin/env bash | |
# Courtesy of @bvierra and company (long ago, pre-cPanel) | |
### Customization: | |
blue="\033[0;34m" | |
brightblue="\033[1;34m" | |
cyan="\033[0;36m" | |
brightcyan="\033[1;36m" | |
green="\033[0;32m" |
-
Create a folder called
~scripts
in your home directory. -
In the directory create a file called
ix
. -
Add the following script to the file
#!/bin/bash
if [ -n "$1" ]; then
curl "ix.io/$1" 2>/dev/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
/* | |
* Problem one | |
* Total of all numbers in an array | |
*/ | |
const myArray1 = [1, 2, 3, 4, 5, 6, 7]; | |
const reducedArray = myArray1.reduce((a, b) => a + b, 0) | |
console.log("+++++++++++++++++Problem one+++++++++++++++++++") | |
console.log(reducedArray); |
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
package main | |
import "fmt" | |
type node struct { | |
data int | |
nextnodepointer *node | |
} | |
type linkedList struct { |
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
package main | |
import "fmt" | |
type node struct { | |
data int | |
nextnodepointer *node | |
} | |
type linkedList struct { |
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
package main | |
import "fmt" | |
type node struct { | |
data int | |
nextnodepointer *node | |
} | |
type linkedList struct { |
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
package main | |
import "fmt" | |
type node struct { | |
data int | |
nextnodepointer *node | |
} | |
type linkedList struct { |
NewerOlder