• How can I optimize it?

Question related to mission Broken Window


Hi all! I try to solve mission `Broken Window`. I written a code and it works good, but for test with 5(or 6) and more arguments it's work very slow, because I use `itertools.permutations`. Can you help me optimize it and pass all tests?

My code in attachment