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
@@ -43,13 +43,13 @@ Output: 21
Write your approach here.
** TODO Python
#+begin_src python
#+begin_src python :lc-problem 7 :lc-lang python3
class Solution:
def reverse(self, x: int) -> int:
#+end_src
** TODO C++
#+begin_src cpp
#+begin_src cpp :lc-problem 7
class Solution {
public:
int reverse(int x) {
@@ -38,13 +38,13 @@ You must implement a solution with a linear runtime complexity and use only cons
Write your approach here.
** TODO Python
#+begin_src python
#+begin_src python :lc-problem 136 :lc-lang python3
class Solution:
def singleNumber(self, nums: List[int]) -> int:
#+end_src
** TODO C++
#+begin_src cpp
#+begin_src cpp :lc-problem 136
class Solution {
public:
int singleNumber(vector<int>& nums) {
@@ -52,13 +52,13 @@ Reverse bits of a given 32 bits signed integer.
Write your approach here.
** TODO Python
#+begin_src python
#+begin_src python :lc-problem 190 :lc-lang python3
class Solution:
def reverseBits(self, n: int) -> int:
#+end_src
** TODO C++
#+begin_src cpp
#+begin_src cpp :lc-problem 190
class Solution {
public:
int reverseBits(int n) {
@@ -46,13 +46,13 @@ The input binary string *1111111111111111111111111111101* has a total of thirty
Write your approach here.
** TODO Python
#+begin_src python
#+begin_src python :lc-problem 191 :lc-lang python3
class Solution:
def hammingWeight(self, n: int) -> int:
#+end_src
** TODO C++
#+begin_src cpp
#+begin_src cpp :lc-problem 191
class Solution {
public:
int hammingWeight(int n) {
@@ -47,13 +47,13 @@ Output: false
Write your approach here.
** TODO Python
#+begin_src python
#+begin_src python :lc-problem 231 :lc-lang python3
class Solution:
def isPowerOfTwo(self, n: int) -> bool:
#+end_src
** TODO C++
#+begin_src cpp
#+begin_src cpp :lc-problem 231
class Solution {
public:
bool isPowerOfTwo(int n) {
@@ -48,13 +48,13 @@ Output: [1,0]
Write your approach here.
** TODO Python
#+begin_src python
#+begin_src python :lc-problem 260 :lc-lang python3
class Solution:
def singleNumber(self, nums: List[int]) -> List[int]:
#+end_src
** TODO C++
#+begin_src cpp
#+begin_src cpp :lc-problem 260
class Solution {
public:
vector<int> singleNumber(vector<int>& nums) {
@@ -52,13 +52,13 @@ Given an array ~nums~ containing ~n~ distinct numbers in the range ~[0, n]~, ret
Write your approach here.
** TODO Python
#+begin_src python
#+begin_src python :lc-problem 268 :lc-lang python3
class Solution:
def missingNumber(self, nums: List[int]) -> int:
#+end_src
** TODO C++
#+begin_src cpp
#+begin_src cpp :lc-problem 268
class Solution {
public:
int missingNumber(vector<int>& nums) {
@@ -49,13 +49,13 @@ Explanation:
Write your approach here.
** TODO Python
#+begin_src python
#+begin_src python :lc-problem 338 :lc-lang python3
class Solution:
def countBits(self, n: int) -> List[int]:
#+end_src
** TODO C++
#+begin_src cpp
#+begin_src cpp :lc-problem 338
class Solution {
public:
vector<int> countBits(int n) {
@@ -30,13 +30,13 @@ Output: 5
Write your approach here.
** TODO Python
#+begin_src python
#+begin_src python :lc-problem 371 :lc-lang python3
class Solution:
def getSum(self, a: int, b: int) -> int:
#+end_src
** TODO C++
#+begin_src cpp
#+begin_src cpp :lc-problem 371
class Solution {
public:
int getSum(int a, int b) {
@@ -48,13 +48,13 @@ It can be shown we cannot convert 3 to 4 in less than 3 steps. Hence, we return
Write your approach here.
** TODO Python
#+begin_src python
#+begin_src python :lc-problem 2220 :lc-lang python3
class Solution:
def minBitFlips(self, start: int, goal: int) -> int:
#+end_src
** TODO C++
#+begin_src cpp
#+begin_src cpp :lc-problem 2220
class Solution {
public:
int minBitFlips(int start, int goal) {