Grokking the Coding Interview: Patterns for Coding Questions
Ask Author
Back to course home

0% completed

Vote For New Content
When I enter this solution on leetcode it is giving me an error. https://leetcod...

Jared

Aug 15, 2022

When I enter this solution on leetcode it is giving me an error. https://leetcode.com/problems/permutation-in-string/ Does anyone know why this solution doesn't work?

0

0

Comments
Comments
Design Gurus
Design Gurus3 years ago

What error do you see?

J
Jared 3 years ago

"ab" "eidbaooo" as pattern and str1 returns true instead of false. It only passes 61/107 test cases

Design Gurus
Design Gurus3 years ago

So your string is "ab" and the pattern is "eidbaooo"?

This returned False, we checked Java and Python.

Which solution are your trying?

J
Jared 3 years ago

No the other way around "ab" as pattern and "eidbaooo" as string

Design Gurus
Design Gurus3 years ago

Well, in that case, the correct output is 'True'.

Why do you expect it to be False?

We have a permutation of the pattern "ab" in the given string.

J
Jared 3 years ago

Sorry misspoke. With "ab" as the pattern the algorithim is returning False instead of True.

Design Gurus
Design Gurus3 years ago

All solutions are returning true (Python, Java, C++, JS)

Probably, you have some local changes.

On this page