This commit is contained in:
2026-06-01 18:12:40 +08:00
parent c9fe2fab76
commit 0f9312eaee
206 changed files with 409 additions and 215 deletions
@@ -1,4 +1,4 @@
#+PROPERTY: STUDY_DECK_02
#+ANKI_DECK: study_deck_02
* TODO 0001. Two Sum :easy:
:PROPERTIES:
:NEETCODE: [[file:../../roadmap.org::*0001. Two Sum][0001. Two Sum]]
@@ -1,4 +1,4 @@
#+PROPERTY: STUDY_DECK_02
#+ANKI_DECK: study_deck_02
* TODO 0036. Valid Sudoku :medium:
:PROPERTIES:
:NEETCODE: [[file:../../roadmap.org::*0036. Valid Sudoku][0036. Valid Sudoku]]
@@ -1,4 +1,4 @@
#+PROPERTY: STUDY_DECK_02
#+ANKI_DECK: study_deck_02
* TODO 0049. Group Anagrams :medium:
:PROPERTIES:
:NEETCODE: [[file:../../roadmap.org::*0049. Group Anagrams][0049. Group Anagrams]]
@@ -1,4 +1,4 @@
#+PROPERTY: STUDY_DECK_02
#+ANKI_DECK: study_deck_02
* TODO 0128. Longest Consecutive Sequence :medium:
:PROPERTIES:
:NEETCODE: [[file:../../roadmap.org::*0128. Longest Consecutive Sequence][0128. Longest Consecutive Sequence]]
@@ -1,4 +1,4 @@
#+PROPERTY: STUDY_DECK_02
#+ANKI_DECK: study_deck_02
* DONE 0217. Contains Duplicate :easy:
:PROPERTIES:
:NEETCODE: [[file:../../roadmap.org::*0217. Contains Duplicate][0217. Contains Duplicate]]
@@ -1,4 +1,4 @@
#+PROPERTY: STUDY_DECK_02
#+ANKI_DECK: study_deck_02
* TODO 0238. Product of Array Except Self :medium:
:PROPERTIES:
:NEETCODE: [[file:../../roadmap.org::*0238. Product of Array Except Self][0238. Product of Array Except Self]]
@@ -1,5 +1,5 @@
#+PROPERTY: STUDY_DECK_02
* TODO 0242. Valid Anagram :easy:
#+ANKI_DECK: study_deck_02
* DONE 0242. Valid Anagram :easy:
:PROPERTIES:
:NEETCODE: [[file:../../roadmap.org::*0242. Valid Anagram][0242. Valid Anagram]]
:END:
@@ -26,21 +26,36 @@ Given two strings ~s~ and ~t~, return ~true~ if ~t~ is an anagram of ~s~, and ~f
*Follow up:* What if the inputs contain Unicode characters? How would you adapt your solution to such a case?
** TODO Approach
** DONE Approach
Write your approach here.
** TODO Python
** DONE Python
#+begin_src python
class Solution:
def isAnagram(self, s: str, t: str) -> bool:
#+end_src
** TODO C++
** DONE C++
#+begin_src cpp
#include <map>
#include <string>
class Solution {
public:
bool isAnagram(string s, string t) {
bool isAnagram(std::string s, std::string t) {
std::map<char, int> ctr;
for (char c: s) {
ctr[c] += c;
}
for (char c: t) {
if (ctr[c] == 0) {
return false;
}
ctr[c] -= 1;
if (ctr[c] == 0) {
ctr.erase(c);
}
}
return ctr.size() == 0;
}
};
#+end_src
@@ -1,4 +1,4 @@
#+PROPERTY: STUDY_DECK_02
#+ANKI_DECK: study_deck_02
* TODO 0271. Encode and Decode Strings :medium:
:PROPERTIES:
:NEETCODE: [[file:../../roadmap.org::*0271. Encode and Decode Strings][0271. Encode and Decode Strings]]
@@ -1,4 +1,4 @@
#+PROPERTY: STUDY_DECK_02
#+ANKI_DECK: study_deck_02
* TODO 0347. Top K Frequent Elements :medium:
:PROPERTIES:
:NEETCODE: [[file:../../roadmap.org::*0347. Top K Frequent Elements][0347. Top K Frequent Elements]]
@@ -1,4 +1,4 @@
#+PROPERTY: STUDY_DECK_02
#+ANKI_DECK: study_deck_02
* TODO 1408. String Matching in an Array :easy:
:PROPERTIES:
:NEETCODE: [[file:../../roadmap.org::*1408. String Matching in an Array][1408. String Matching in an Array]]
@@ -1,4 +1,4 @@
#+PROPERTY: STUDY_DECK_02
#+ANKI_DECK: study_deck_02
* TODO 1769. Minimum Number of Operations to Move All Balls to Each Box :medium:
:PROPERTIES:
:NEETCODE: [[file:../../roadmap.org::*1769. Minimum Number of Operations to Move All Balls to Each Box][1769. Minimum Number of Operations to Move All Balls to Each Box]]
@@ -1,4 +1,4 @@
#+PROPERTY: STUDY_DECK_02
#+ANKI_DECK: study_deck_02
* TODO 2678. Number of Senior Citizens :easy:
:PROPERTIES:
:NEETCODE: [[file:../../roadmap.org::*2678. Number of Senior Citizens][2678. Number of Senior Citizens]]