From 1a17934bcd9fcf035ac04f0e6fc22ddde5ae0c63 Mon Sep 17 00:00:00 2001 From: Ashwin Ramadevanahalli Date: Sun, 14 Feb 2016 04:22:19 -0800 Subject: [PATCH] Update ChapQ1.3.py 'In' is much faster than 'find'. The latter is used to find the index. Ref: http://stackoverflow.com/questions/18437798/find-vs-in-operation-in-string-python --- python/Chapter 1/Question1_3/ChapQ1.3.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/Chapter 1/Question1_3/ChapQ1.3.py b/python/Chapter 1/Question1_3/ChapQ1.3.py index 1266f349..0301c5aa 100644 --- a/python/Chapter 1/Question1_3/ChapQ1.3.py +++ b/python/Chapter 1/Question1_3/ChapQ1.3.py @@ -6,7 +6,7 @@ def isPermutation(s1, s2): return False else: for char in s1: - if s2.find(char)==-1: + if char not in s2: return False else: s2 = s2.replace(char,"",1)