{{ message }}

Instantly share code, notes, and snippets.

Created Mar 14, 2019
Visual Studio Code Settings Sync Gist
View cloudSettings
Last active Sep 5, 2018
Deep flatten an array
View deep_flatten.js
 const input = [[1, 2, [3]], 4]; // ––––– Option 1 ––––– function baseFlatten(array, depth, result) { result || (result = []); if (array == null) { return result; }
Created Apr 25, 2017
Project Euler Question 2
View main.py
 # Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: # # 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... # # By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms. # Find the sum of the even-valued terms < four million in the Fibonacci sequence class Fibonacci_numbers:
Created Apr 24, 2017
Project Euler Question 1
View main.py
 # If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. # Find the sum of all the multiples of 3 or 5 below 1000. class Multiples: def __init__(self, num, min, max): self.__num = num self.__min = self.round_step(min) self.__max = max
Last active Jan 25, 2017
QuickSort Recursive Function In JavasScript
View quicksort.js
 function quickSort(numbers, target, partial) { var sum, remaining; var partial = partial || []; // sum partial sum = partial.reduce(function (a, b) { return a + b; }, 0); // check if the sum partial equals the target
You can’t perform that action at this time.