{{ message }}

Instantly share code, notes, and snippets.

# я котик пур-пур mvasilkov

Created Nov 20, 2011
Tail recursive power function
View power.py
 from functools import partial, wraps def power_tail(x, a, n): assert n >= 0 if n == 0: return x elif n & 1: return partial(power_tail, x * a, a, n - 1) else: return partial(power_tail, x, a * a, n >> 1)
Created Aug 8, 2017 — forked from joepalala/react_samples_list.md
React Samples List
View react_samples_list.md
Last active Feb 19, 2020
Count isolated regions in a table
View count_regions.js
 'use strict' // The following table has 6 connected regions: const tab = ` 111100000000000000000 111000000001110011000 110000000000011111100 000000000111111100000 110000011111000000000
Created Feb 12, 2020
 'use strict' const assert = require('assert').strict /** * Write a program that outputs all possibilities to put + or - or nothing * between the numbers 1, 2, ..., 9 (in this order) such that the result * equals 100. For example: 1 + 2 + 34 – 5 + 67 – 8 + 9 = 100. */
Last active Feb 11, 2020
Programming assignment №2
 'use strict' /** * Write a function that given a list of non negative integers, * arranges them such that they form the largest possible number. * For example, given [50, 2, 1, 9], the largest formed number is 95021. */ /* 1. Straightforward solution: get all permutations of numbers. * Then find the largest of those.
Last active Feb 11, 2020
Programming interview question
View print_ipv4.js
 'use strict' // Take a valid octet from a string. Octet can be 1-3 characters function takeOctet(octets, string) { // If we have 4 octets, and nothing is left on the string, we're done if (octets.length === 4) { if (string.length === 0) { console.log(`\${octets}.\${octets}.\${octets}.\${octets}`) } // Return anyway
Last active Nov 26, 2019
Вороны клюют твою задачу, Джузеппе!