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
#lang scheme | |
(define (square x) (* x x)) | |
(define (gcd a b) | |
(if (= 0 b) | |
a | |
(gcd b (remainder a b)))) | |
(define (expmod base exp m) | |
(cond ((= exp 0) 1) |
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
/** | |
* 多项式相乘 [多项式1, 多项式2, 多项式3...] | |
* 多项式 {次数1: 系数1, 次数2: 系数2, ...} | |
*/ | |
var simplePolynomials = [ | |
{ | |
0: 1, | |
1: 1, | |
2: 1, | |
3: 1, |
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
"use strict"; | |
function next (str) { | |
const charArr = str.split(''); | |
const charReverseArr = charArr.reverse(); | |
const inflectionIndex = charReverseArr.findIndex((element, index, array) => element < array[index - 1]); | |
const right = charReverseArr.slice(0, inflectionIndex); |
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 testClosures() { | |
"use strict"; | |
var result = []; | |
for (var var_index = 0; var_index < 2; var_index++) { | |
result.push(() => { return var_index; }); | |
} | |
for (let let_index = 0; let_index < 2; let_index++) { | |
result.push(() => { return let_index; }); | |
} |
NewerOlder