This commit is contained in:
2026-06-05 22:32:49 +08:00
parent 14d05011d5
commit c67841fe07
202 changed files with 498 additions and 403 deletions
@@ -54,7 +54,7 @@ Output: [0,1]
Write your approach here.
** TODO Python
#+begin_src python
#+begin_src python :lc-problem 1 :lc-lang python3
class Solution:
def twoSum(self, nums: List[int], target: int) -> List[int]:
sb = {}
@@ -66,7 +66,7 @@ class Solution:
#+end_src
** TODO C++
#+begin_src cpp
#+begin_src cpp :lc-problem 1
class Solution {
public:
vector<int> twoSum(vector<int>& nums, int target) {
@@ -67,13 +67,13 @@ Explanation: Same as Example 1, except with the 5 in the top left corner being m
Write your approach here.
** TODO Python
#+begin_src python
#+begin_src python :lc-problem 36 :lc-lang python3
class Solution:
def isValidSudoku(self, board: List[List[str]]) -> bool:
#+end_src
** TODO C++
#+begin_src cpp
#+begin_src cpp :lc-problem 36
class Solution {
public:
bool isValidSudoku(vector<vector<char>>& board) {
@@ -44,13 +44,13 @@ Given an array of strings ~strs~, group the anagrams together. You can return th
Write your approach here.
** TODO Python
#+begin_src python
#+begin_src python :lc-problem 49 :lc-lang python3
class Solution:
def groupAnagrams(self, strs: List[str]) -> List[List[str]]:
#+end_src
** TODO C++
#+begin_src cpp
#+begin_src cpp :lc-problem 49
class Solution {
public:
vector<vector<string>> groupAnagrams(vector<string>& strs) {
@@ -46,13 +46,13 @@ Output: 3
Write your approach here.
** TODO Python
#+begin_src python
#+begin_src python :lc-problem 128 :lc-lang python3
class Solution:
def longestConsecutive(self, nums: List[int]) -> int:
#+end_src
** TODO C++
#+begin_src cpp
#+begin_src cpp :lc-problem 128
class Solution {
public:
int longestConsecutive(vector<int>& nums) {
@@ -42,7 +42,7 @@ All elements are distinct.
Write your approach here.
** DONE Python
#+begin_src python
#+begin_src python :lc-problem 217 :lc-lang python3
class Solution:
def containsDuplicate(self, nums: List[int]) -> bool:
s = set()
@@ -54,7 +54,7 @@ class Solution:
#+end_src
** DONE C++
#+begin_src cpp
#+begin_src cpp :lc-problem 217
#include <vector>
#include <set>
class Solution {
@@ -40,13 +40,13 @@ Output: [0,0,9,0,0]
Write your approach here.
** TODO Python
#+begin_src python
#+begin_src python :lc-problem 238 :lc-lang python3
class Solution:
def productExceptSelf(self, nums: List[int]) -> List[int]:
#+end_src
** TODO C++
#+begin_src cpp
#+begin_src cpp :lc-problem 238
class Solution {
public:
vector<int> productExceptSelf(vector<int>& nums) {
@@ -30,13 +30,13 @@ Given two strings ~s~ and ~t~, return ~true~ if ~t~ is an anagram of ~s~, and ~f
Write your approach here.
** DONE Python
#+begin_src python
#+begin_src python :lc-problem 242 :lc-lang python3
class Solution:
def isAnagram(self, s: str, t: str) -> bool:
#+end_src
** DONE C++
#+begin_src cpp
#+begin_src cpp :lc-problem 242
#include <map>
#include <string>
class Solution {
@@ -8,11 +8,11 @@
Write your approach here.
** TODO Python
#+begin_src python
#+begin_src python :lc-problem 271 :lc-lang python3
#+end_src
** TODO C++
#+begin_src cpp
#+begin_src cpp :lc-problem 271
#+end_src
@@ -48,7 +48,7 @@ class Solution:
#+end_src
** TODO C++
#+begin_src cpp
#+begin_src cpp :lc-problem 347
class Solution {
public:
vector<int> topKFrequent(vector<int>& nums, int k) {
@@ -51,7 +51,7 @@ Explanation: No string of words is substring of another string.
Write your approach here.
** TODO Python
#+begin_src python
#+begin_src python :lc-problem 1408 :lc-lang python3
from collections import defaultdict as dd
class Solution:
def stringMatching(self, words: List[str]) -> List[str]:
@@ -87,7 +87,7 @@ class Solution:
**
** TODO C++
#+begin_src cpp
#+begin_src cpp :lc-problem 1408
class Solution {
public:
vector<string> stringMatching(vector<string>& words) {
@@ -46,13 +46,13 @@ Output: [11,8,5,4,3,4]
Write your approach here.
** TODO Python
#+begin_src python
#+begin_src python :lc-problem 1769 :lc-lang python3
class Solution:
def minOperations(self, boxes: str) -> List[int]:
#+end_src
** TODO C++
#+begin_src cpp
#+begin_src cpp :lc-problem 1769
class Solution {
public:
vector<int> minOperations(string boxes) {
@@ -52,13 +52,13 @@ Explanation: None of the passengers are older than 60.
Write your approach here.
** TODO Python
#+begin_src python
#+begin_src python :lc-problem 2678 :lc-lang python3
class Solution:
def countSeniors(self, details: List[str]) -> int:
#+end_src
** TODO C++
#+begin_src cpp
#+begin_src cpp :lc-problem 2678
class Solution {
public:
int countSeniors(vector<string>& details) {