Sha256: a136638e2497ececaaecd1b2b4f21dfc6629120834f942ed8dd859308e0986dd
Contents?: true
Size: 417 Bytes
Versions: 127
Compression:
Stored size: 417 Bytes
Contents
import "dart:math" show pow; class DifferenceOfSquares { int squareOfSums(int input) => pow(_sum(input), 2); int sumOfSquares(int input) => _range(input).map((i) => pow(i, 2)).reduce((r, i) => r + i); int difference(int input) => squareOfSums(input) - sumOfSquares(input); int _sum(int input) => input * (input + 1) ~/ 2; List<int> _range(int length) => new List<int>.generate(length, (i) => i + 1); }
Version data entries
127 entries across 127 versions & 1 rubygems