Sha256: 868418679502ad1031cf62d5b4775b08382b654052188dd1f5e7f317a1c1b520
Contents?: true
Size: 638 Bytes
Versions: 396
Compression:
Stored size: 638 Bytes
Contents
#include "series.h" #include <stdexcept> using namespace std; namespace series { vector<int> digits(string const& sequence) { vector<int> result; for (const char digit : sequence) { result.push_back(digit - '0'); } return result; } vector<vector<int>> slice(string const& sequence, int span) { if (span > static_cast<int>(sequence.length())) { throw domain_error("Requested span too long for sequence"); } vector<vector<int>> result; for (size_t i = 0; i < sequence.length() - (span - 1); ++i) { result.push_back(digits(sequence.substr(i, span))); } return result; } }
Version data entries
396 entries across 396 versions & 1 rubygems