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
@@ -45,13 +45,13 @@ Output: 2
Write your approach here.
** TODO Python
#+begin_src python
#+begin_src python :lc-problem 45 :lc-lang python3
class Solution:
def jump(self, nums: List[int]) -> int:
#+end_src
** TODO C++
#+begin_src cpp
#+begin_src cpp :lc-problem 45
class Solution {
public:
int jump(vector<int>& nums) {
@@ -48,13 +48,13 @@ Explanation: The subarray [5,4,-1,7,8] has the largest sum 23.
Write your approach here.
** TODO Python
#+begin_src python
#+begin_src python :lc-problem 53 :lc-lang python3
class Solution:
def maxSubArray(self, nums: List[int]) -> int:
#+end_src
** TODO C++
#+begin_src cpp
#+begin_src cpp :lc-problem 53
class Solution {
public:
int maxSubArray(vector<int>& nums) {
@@ -38,13 +38,13 @@ Explanation: You will always arrive at index 3 no matter what. Its maximum jump
Write your approach here.
** TODO Python
#+begin_src python
#+begin_src python :lc-problem 55 :lc-lang python3
class Solution:
def canJump(self, nums: List[int]) -> bool:
#+end_src
** TODO C++
#+begin_src cpp
#+begin_src cpp :lc-problem 55
class Solution {
public:
bool canJump(vector<int>& nums) {
@@ -57,13 +57,13 @@ Therefore, you can&#39;t travel around the circuit once no matter where you star
Write your approach here.
** TODO Python
#+begin_src python
#+begin_src python :lc-problem 134 :lc-lang python3
class Solution:
def canCompleteCircuit(self, gas: List[int], cost: List[int]) -> int:
#+end_src
** TODO C++
#+begin_src cpp
#+begin_src cpp :lc-problem 134
class Solution {
public:
int canCompleteCircuit(vector<int>& gas, vector<int>& cost) {
@@ -49,13 +49,13 @@ Output: true
Write your approach here.
** TODO Python
#+begin_src python
#+begin_src python :lc-problem 678 :lc-lang python3
class Solution:
def checkValidString(self, s: str) -> bool:
#+end_src
** TODO C++
#+begin_src cpp
#+begin_src cpp :lc-problem 678
class Solution {
public:
bool checkValidString(string s) {
@@ -42,13 +42,13 @@ Output: [10]
Write your approach here.
** TODO Python
#+begin_src python
#+begin_src python :lc-problem 763 :lc-lang python3
class Solution:
def partitionLabels(self, s: str) -> List[int]:
#+end_src
** TODO C++
#+begin_src cpp
#+begin_src cpp :lc-problem 763
class Solution {
public:
vector<int> partitionLabels(string s) {
@@ -42,13 +42,13 @@ Explanation: Alice&#39;s hand can not be rearranged into groups of 4.
Write your approach here.
** TODO Python
#+begin_src python
#+begin_src python :lc-problem 846 :lc-lang python3
class Solution:
def isNStraightHand(self, hand: List[int], groupSize: int) -> bool:
#+end_src
** TODO C++
#+begin_src cpp
#+begin_src cpp :lc-problem 846
class Solution {
public:
bool isNStraightHand(vector<int>& hand, int groupSize) {
@@ -41,13 +41,13 @@ It can be shown that it is impossible for the array to have all unique values wi
Write your approach here.
** TODO Python
#+begin_src python
#+begin_src python :lc-problem 945 :lc-lang python3
class Solution:
def minIncrementForUnique(self, nums: List[int]) -> int:
#+end_src
** TODO C++
#+begin_src cpp
#+begin_src cpp :lc-problem 945
class Solution {
public:
int minIncrementForUnique(vector<int>& nums) {
@@ -60,13 +60,13 @@ Output: 1
Write your approach here.
** TODO Python
#+begin_src python
#+begin_src python :lc-problem 978 :lc-lang python3
class Solution:
def maxTurbulenceSize(self, arr: List[int]) -> int:
#+end_src
** TODO C++
#+begin_src cpp
#+begin_src cpp :lc-problem 978
class Solution {
public:
int maxTurbulenceSize(vector<int>& arr) {
@@ -47,13 +47,13 @@ Output: false
Write your approach here.
** TODO Python
#+begin_src python
#+begin_src python :lc-problem 1871 :lc-lang python3
class Solution:
def canReach(self, s: str, minJump: int, maxJump: int) -> bool:
#+end_src
** TODO C++
#+begin_src cpp
#+begin_src cpp :lc-problem 1871
class Solution {
public:
bool canReach(string s, int minJump, int maxJump) {
@@ -61,13 +61,13 @@ The target triplet [5,5,5] is now an element of triplets.
Write your approach here.
** TODO Python
#+begin_src python
#+begin_src python :lc-problem 1899 :lc-lang python3
class Solution:
def mergeTriplets(self, triplets: List[List[int]], target: List[int]) -> bool:
#+end_src
** TODO C++
#+begin_src cpp
#+begin_src cpp :lc-problem 1899
class Solution {
public:
bool mergeTriplets(vector<vector<int>>& triplets, vector<int>& target) {