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

[pull] master from youngyangyang04:master #458

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
jenningsloy318 merged 4 commits into AlgorithmAndLeetCode:master from youngyangyang04:master
Jun 19, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Update 0242: Add C solution
  • Loading branch information
blueskyson authored Jun 15, 2024
commit 0f6ea64f68857ea7c080b820f31b88f622cab276
25 changes: 25 additions & 0 deletions problems/0242.有效的字母异位词.md
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,31 @@ object Solution {
}
```

### C

```c
bool isAnagram(char* s, char* t) {
int len1 = strlen(s), len2 = strlen(t);
if (len1 != len2) {
return false;
}

int map1[26] = {0}, map2[26] = {0};
for (int i = 0; i < len1; i++) {
map1[s[i] - 'a'] += 1;
map2[t[i] - 'a'] += 1;
}

for (int i = 0; i < 26; i++) {
if (map1[i] != map2[i]) {
return false;
}
}

return true;
}
```

## 相关题目

* [383.赎金信](https://programmercarl.com/0383.%E8%B5%8E%E9%87%91%E4%BF%A1.html)
Expand Down

AltStyle によって変換されたページ (->オリジナル) /