Question: In given string, find whether it contains any permutation of another string. For example, given abcdefgh and ba, the function should return true, because abcdefgh

In given string, find whether it contains any permutation of another string. For example, given "abcdefgh" and "ba", the function should return true, because "abcdefgh" has substring "ab", which is a permutation of the given string "ba".

Step by Step Solution

3.38 Rating (164 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To solve this problem efficiently we can use a sliding window technique combined with frequency counting Heres a Java code implementation of the solution import javautilHashMap import javautilMap publ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Data Structures Algorithms Questions!