From c045314cc89044dc6753448ab7f24582f87d2cf6 Mon Sep 17 00:00:00 2001 From: huangrui199126 Date: Sun, 28 Aug 2016 18:41:31 -0700 Subject: [PATCH] word_square.py go through the test of pep8 and pylint --- Problems/src/Bit/word_square.py | 60 +++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 Problems/src/Bit/word_square.py diff --git a/Problems/src/Bit/word_square.py b/Problems/src/Bit/word_square.py new file mode 100644 index 0000000..cb0cd45 --- /dev/null +++ b/Problems/src/Bit/word_square.py @@ -0,0 +1,60 @@ +""" +Word Square definition, 0<=k= min_length] + for i, string in enumerate(strs_filtered): + if validate(step, path, string): + path.append(string) + strs.remove(string) + dfs(strs, k, path, step + 1, res) + strs.insert(i, string) + path.pop() + + +TEST = ["ABCD", "BNRT", "CRMY", "DTYE", "CRM", "DT", "DTY"] +print word_square(TEST, 4)