I hereby claim:
- I am loschtreality on github.
- I am loschtreality (https://keybase.io/loschtreality) on keybase.
- I have a public key ASBxYuByFwAEGGXVq2PAthoc1kL_vK2tQkHQg0G5qVEjTwo
To claim this, I am signing this object:
| // Write a function which takes in an array of elements and prints the elements in reverse to the console | |
| function printBackwards(inputArray) { | |
| // write your code here | |
| } | |
| // A few tests | |
| console.log(printBackwards([1, 2, 3, 4, 5])) // prints "5 4 3 2 1" | |
| console.log(printBackwards(["o", "l", "l", "e", "h"]) // prints "h e l l o" |
I hereby claim:
To claim this, I am signing this object:
| cd() { builtin cd "$@"; ls; } |
| const solution = (array) => { | |
| const maxEndings = [0, 0, 0, 0, 0, 0, 0, 0] | |
| const maxBeginnings = [0, 0, 0, 0, 0, 0, 0, 0] | |
| for (let i = 1, len = array.length - 1; i < len; i++) { | |
| maxEndings[i] = Math.max(maxEndings[i - 1] + array[i], 0) | |
| } | |
| for (let j = array.length - 2; j > 0; j--) { |
| const solution = (array) => { | |
| if (array.length === 0) return 0 | |
| const midPoint = Math.floor(array.length / 2) | |
| const left = array.slice(1, midPoint - 1) | |
| const right = array.slice(midPoint, array.length - 2) | |
| const leftSum = left.reduce((sum, current) => { return sum + current }, 0) | |
| const rightSum = right.reduce((sum, current) => { return sum + current }, 0) |
| const fifth_largest = (array) => { | |
| const cache = [] | |
| let highest = -Infinity | |
| let highest_index = -1 | |
| for (var i = 0; i < 5; i++) { | |
| for (var index = 0; index < array.length; index++) { | |
| if (array[index] > highest) { | |
| highest = array[index] |
| // Given a string, write a function that uses recursion to output a list of all the possible permutations of that string. | |
| // For example, given s='abc' the function should return ['abc', 'acb', 'bac', 'bca', 'cab', 'cba'] | |
| // Note: If a character is repeated, treat each occurence as distinct, | |
| // for example an input of 'xxx' would return a list with 6 "versions" of 'xxx' | |
| const permutations = (string) => { | |
| let output = [] |