Skip to content

Instantly share code, notes, and snippets.

View rptoma's full-sized avatar
🎯
Focusing

Toma Radu-Petrescu rptoma

🎯
Focusing
  • Bucharest, Romania
View GitHub Profile
@therightstuff
therightstuff / _end-to-end-enc.js.md
Last active December 19, 2023 02:17
Javascript / Node.js end-to-end encryption
@conache
conache / Workers.cpp
Last active February 25, 2017 11:59
#include <iostream>
#include <vector>
#include <map>
using namespace std;
class Data{
int an,zi, luna;
public:
Data( int a=0, int z=0, int l=0){
an = a;
zi = z;
extension Array {
var powerSet: [[Element]] {
guard !isEmpty else { return [[]] }
return Array(self[1...]).powerSet.flatMap { [$0, [self[0]] + $0] }
}
}
print([1,2,3,4].powerSet) // -> [[], [1], [2], [1, 2], [3], [1, 3], [2, 3], [1, 2, 3], [4], [1, 4], [2, 4], [1, 2, 4], [3, 4], [1, 3, 4], [2, 3, 4], [1, 2, 3, 4]]