В инете не нашел :-(
import random
a = list(range(10000))
while s := (sum(l := [random.choice(a) for _ in range(6)])) != 10000:
print(s, l)
function removeSomeShit(arr) {
const table = {};
const result = [];
for(const current of arr) {
const {uid, owner, createdAt} = current;
const uidOvnerKey = `${uid}\0${owner}`;
const ownerUidKey = `${owner}\0${uid}`;
const matched = table[uidOvnerKey];
if (matched) {
delete table[uidOvnerKey];
result.push(matched.createdAt > createdAt ? matched : current);
} else {
table[ownerUidKey] = current;
}
};
return Object.values(table).concat(result);
}