summaryrefslogtreecommitdiff
path: root/string/deBruijn.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'string/deBruijn.cpp')
-rw-r--r--string/deBruijn.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/string/deBruijn.cpp b/string/deBruijn.cpp
new file mode 100644
index 0000000..e829137
--- /dev/null
+++ b/string/deBruijn.cpp
@@ -0,0 +1,7 @@
+string deBruijn(int n, char mi = '0', char ma = '1') {
+ string res, c(1, mi);
+ do {
+ if (n % sz(c) == 0) res += c;
+ } while(next(c, n, mi, ma));
+ return res;
+}