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
@@ -46,13 +46,13 @@ Explanation: merged array = [1,2,3,4] and median is (2 + 3) / 2 = 2.5.
Write your approach here.
** TODO Python
#+begin_src python
#+begin_src python :lc-problem 4 :lc-lang python3
class Solution:
def findMedianSortedArrays(self, nums1: List[int], nums2: List[int]) -> float:
#+end_src
** TODO C++
#+begin_src cpp
#+begin_src cpp :lc-problem 4
class Solution {
public:
double findMedianSortedArrays(vector<int>& nums1, vector<int>& nums2) {
@@ -51,13 +51,13 @@ Output: -1
Write your approach here.
** TODO Python
#+begin_src python
#+begin_src python :lc-problem 33 :lc-lang python3
class Solution:
def search(self, nums: List[int], target: int) -> int:
#+end_src
** TODO C++
#+begin_src cpp
#+begin_src cpp :lc-problem 33
class Solution {
public:
int search(vector<int>& nums, int target) {
@@ -46,13 +46,13 @@ Output: false
Write your approach here.
** TODO Python
#+begin_src python
#+begin_src python :lc-problem 74 :lc-lang python3
class Solution:
def searchMatrix(self, matrix: List[List[int]], target: int) -> bool:
#+end_src
** TODO C++
#+begin_src cpp
#+begin_src cpp :lc-problem 74
class Solution {
public:
bool searchMatrix(vector<vector<int>>& matrix, int target) {
@@ -62,13 +62,13 @@ Explanation: The original array was [11,13,15,17] and it was rotated 4 times.
Write your approach here.
** TODO Python
#+begin_src python
#+begin_src python :lc-problem 153 :lc-lang python3
class Solution:
def findMin(self, nums: List[int]) -> int:
#+end_src
** TODO C++
#+begin_src cpp
#+begin_src cpp :lc-problem 153
class Solution {
public:
int findMin(vector<int>& nums) {
@@ -42,13 +42,13 @@ Explanation: 2 does not exist in nums so return -1
Write your approach here.
** TODO Python
#+begin_src python
#+begin_src python :lc-problem 704 :lc-lang python3
class Solution:
def search(self, nums: List[int], target: int) -> int:
#+end_src
** TODO C++
#+begin_src cpp
#+begin_src cpp :lc-problem 704
class Solution {
public:
int search(vector<int>& nums, int target) {
@@ -54,13 +54,13 @@ Output: 5
Write your approach here.
** TODO Python
#+begin_src python
#+begin_src python :lc-problem 719 :lc-lang python3
class Solution:
def smallestDistancePair(self, nums: List[int], k: int) -> int:
#+end_src
** TODO C++
#+begin_src cpp
#+begin_src cpp :lc-problem 719
class Solution {
public:
int smallestDistancePair(vector<int>& nums, int k) {
@@ -51,13 +51,13 @@ Output: 23
Write your approach here.
** TODO Python
#+begin_src python
#+begin_src python :lc-problem 875 :lc-lang python3
class Solution:
def minEatingSpeed(self, piles: List[int], h: int) -> int:
#+end_src
** TODO C++
#+begin_src cpp
#+begin_src cpp :lc-problem 875
class Solution {
public:
int minEatingSpeed(vector<int>& piles, int h) {
@@ -51,7 +51,7 @@ timeMap.get("foo", 5); // return "bar2"
Write your approach here.
** TODO Python
#+begin_src python
#+begin_src python :lc-problem 981 :lc-lang python3
class TimeMap:
def __init__(self):
@@ -71,7 +71,7 @@ class TimeMap:
#+end_src
** TODO C++
#+begin_src cpp
#+begin_src cpp :lc-problem 981
class TimeMap {
public:
TimeMap() {
@@ -54,13 +54,13 @@ Thus, [2,0,2] is returned.
Write your approach here.
** TODO Python
#+begin_src python
#+begin_src python :lc-problem 2300 :lc-lang python3
class Solution:
def successfulPairs(self, spells: List[int], potions: List[int], success: int) -> List[int]:
#+end_src
** TODO C++
#+begin_src cpp
#+begin_src cpp :lc-problem 2300
class Solution {
public:
vector<int> successfulPairs(vector<int>& spells, vector<int>& potions, long long success) {