Permutation in String LeetCode | Permutation in String Java | LeetCode 567

preview_player
Показать описание
In this tutorial, I have explained how to solved Permutation in String LeetCode question by using constant space O(1).

Given two strings s1 and s2, write a function to return true if s2 contains the permutation of s1.

Example 1:

Input: s1 = "ab" s2 = "eidbaooo"
Output: True

Explanation: s2 contains one permutation of s1 ("ba").

Example 2:

Input:s1= "ab" s2 = "eidboaoo"
Output: False

LeetCode May Coding Challenge Day 18

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

Good explanation, what I understand is if I use HasMap then the time complexity will be O(n) instead of O(1).

SandeepKumar-qghr
Автор

I still don't understand why we need to remove the character at ith index

allistermi
Автор

Not working for the testcase
"ab"
"a"

:(

shrehachowdhury
welcome to shbcf.ru