- 
                Notifications
    You must be signed in to change notification settings 
- Fork 379
Closed
Description
Your LeetCode username
ahmedamr
Category of the bug
- Question
- Solution
- Language
- Missing Test Cases
Description of the bug
The third solution to the problem titled Approach #3 Using Hashmap [Time Limit Exceeded] states an incorrect verdict, I've tried using this approach using Python3 and the solution was Accepted not TLE.
Furthermore, Approach #4 Using Array [Accepted] have the same complexity analysis as Approach #3 Using Hashmap [Time Limit Exceeded], so it's expected that both of them to have the same verdict.
Code you used for Submit/Run operation
## 567. Permutation in String, approach 3
from collections import Counter
class Solution:
    def checkInclusion(self, s1: str, s2: str) -> bool:
        n = len(s1)
        m = len(s2)
        
        if n > m:
            return False
        
        s1map = dict(Counter(s1))
        
        for i in range(m-n+1):
            s2map = dict(Counter(s2[i:i+n]))
            if s1map == s2map:
                return True
        return FalseLanguage used for code
Python 3
Expected behavior
Expected that Approach #3 Using Hashmap [Time Limit Exceeded] is Accepted as it has the same complexity analysis as Approach #4 Using Array [Accepted] which is accepted.
Screenshots
N/A
Additional context
Accepted Submission with approach 3: https://leetcode.com/submissions/detail/703403688/