mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
训练(题单)功能
This commit is contained in:
1 parent
e06283c0cc
commit
97b0d782b9
24 files changed
+466
-105
No files matched your search
@@ -36,3 +36,22 @@ Date.prototype.format = function formatDate(fmt = '%Y-%m-%d %H:%M:%S') {
|
||||
.replace('%M', this.getMinutes())
|
||||
.replace('%S', this.getSeconds());
|
||||
};
|
||||
|
||||
Set.isSuperset = function isSuperset(set, subset) {
|
||||
for (const elem of subset) {
|
||||
if (!set.has(elem)) return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
Set.union = function union(setA, setB) {
|
||||
const _union = new Set(setA);
|
||||
for (const elem of setB) _union.add(elem);
|
||||
return _union;
|
||||
};
|
||||
Set.intersection = function intersection(setA, setB) {
|
||||
const _intersection = new Set();
|
||||
for (const elem of setB) {
|
||||
if (setA.has(elem)) _intersection.add(elem);
|
||||
}
|
||||
return _intersection;
|
||||
};
|
||||
Reference in new issue
Block a user