File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed
c-sharp/Problems/sliding-window Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change 15
15
* Output: false
16
16
*
17
17
* Constraints:
18
- * • 1 <= s1.length, s2.length <= 104
18
+ * • 1 <= s1.length, s2.length <= 10^4
19
19
* • s1 and s2 consist of lowercase English letters.
20
+ *
21
+ * Hint 1:
22
+ * Obviously, brute force will result in TLE. Think of something else.
23
+ *
24
+ * Hint 2:
25
+ * How will you check whether one string is a permutation of another string?
26
+ *
27
+ * Hint 3:
28
+ * One way is to sort the string and then compare.
29
+ * But, Is there a better way?
30
+ *
31
+ * Hint 4:
32
+ * If one string is a permutation of another string then they must one common metric.
33
+ * What is that?
34
+ *
35
+ * Hint 5:
36
+ * Both strings must have same character frequencies, if one is permutation of another.
37
+ * Which data structure should be used to store frequencies?
38
+ *
39
+ * Hint 6:
40
+ * What about hash table? An array of size 26?
20
41
**
21
42
* https://leetcode.com/problems/permutation-in-string/
22
43
***/
You can’t perform that action at this time.
0 commit comments