Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9e4909c

Browse files
contents/algorithms: fix incorrect time complexity for anagrams (#692)
Co-authored-by: Atharva <atharvakhadake759@gmail.com>
1 parent3d61290 commit9e4909c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

‎apps/website/contents/algorithms/string.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ An anagram is word switch or word play. It is the result of rearranging the lett
9595

9696
To determine if two strings are anagrams, there are a few approaches:
9797

98-
- Sorting both strings should produce the same resulting string. This takes O(n.log(n)) time and O(log(n)) space.
98+
- Sorting both strings should produce the same resulting string. This takes O(n.log(n)) time and O(n) space.
9999
- If we map each character to a prime number and we multiply each mapped number together, anagrams should have the same multiple (prime factor decomposition). This takes O(n) time and O(1) space. Examples:[Group Anagram](https://leetcode.com/problems/group-anagrams/)
100100
- Frequency counting of characters will help to determine if two strings are anagrams. This also takes O(n) time and O(1) space.
101101

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp