[Java] Leetcode 567. Permutation in String [Sliding Window #7]

preview_player
Показать описание
In this video, I'm going to show you how to solve Leetcode 567. Permutation in String which is related to Sliding Window.

Here’s a quick rundown of what you’re about to learn:

⭐️ Course Contents ⭐️
⌨️ (0:00) Question
⌨️ (1:11) Solution Explain
⌨️ (2:25) Code

In the end, you’ll have a really good understanding on how to solve Leetcode 567. Permutation in String and questions that are similar to Sliding Window.

Now, if you want to get good at Sliding Window, please checkout my Sliding Window playlist.

Рекомендации по теме
Комментарии
Автор

I like how clear and well paced the videos are

mikeymike
Автор

Thank you! The --arr[cur] >= 0 and the ++arr[left] > 0 kinda confused me. So the --arr[cur] >= 0 if checking if the character exists in the arr, and the ++arr[left] > 0 is checking if the char doesn't exist?

wonghuang
Автор

You can increase speed with the arr[char -''a"] trick, only needing an array of 26 letters.Thanks for sharing!

micosair
Автор

What does count mean? The unique number of characters in s1?

ruilinzhang
Автор

can we not predefine the size of the window to be the length of s1, since i think the permutations are all continuous and, count the frequency of each charactres in all the windows, if any window's character's freq== s1's characters's freq we can return true

chaitanyasharma
Автор

Also, can we use a hashMap for this question? since the videos in the playlist are mostly using hashmap, then this question you used array.

wonghuang
Автор

"hello"
"ooolleoooleh"
this solution won't work for this testcase

bearmarketbuidlr