Leetcode#169. Majority Element
ProblemGiven an array nums of size n, return the majority element.
The majority element is the element that appears more than ⌊n / 2⌋ times. You may assume that the majority element always exists in the array.
Example 1:
123Input: nums = [3,2,3]Output: 3
Example 2:
123Input: nums = [2,2,1,1,1,2,2]Output: 2
Constraints:
n == nums.length
1 <= n <= 5 * 104
109 <= nums[i] <= 109
Follow-up:
Could you solve the problem in linear time and in
1O(1)
space?
Solve解112345678910class Solutio ...
Leetcode#80. Remove Duplicates from Sorted Array II
ProblemGiven an integer array nums sorted in non-decreasing order, remove some duplicates in-place such that each unique element appears at most twice. The relative order of the elements should be kept the same.
Since it is impossible to change the length of the array in some languages, you must instead have the result be placed in the first part of the array nums. More formally, if there are k elements after removing the duplicates, then the first k elements of nums should hold the final result ...
(Bug)git 推送問題 git add .
使用 git add .
1git add . fatal: will not add file alias 'public/tags/OpenCV/index.html' ('public/tags/opencv/index.html' already exists in index)
git commit -m “ ”
後面也出現一堆 modified…… 紅字
12345678Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git restore <file>..." to discard changes in working directory) modified: .gitignore modified: . . .
原因這個錯誤是因為 Git 在 W ...
github 不能推的其中一種狀況 甚至雲端是空的
1234567To https://github.com/name/resp.git ! [rejected] main -> main (non-fast-forward)error: failed to push some refs to 'https://github.com/name/resp.git'hint: Updates were rejected because the tip of your current branch is behindhint: its remote counterpart. Integrate the remote changes (e.g.hint: 'git pull ...') before pushing again.hint: See the 'Note about fast-forwards' in 'git push --help' for details.
若是有東西 可以先pull下來,因為可能本機是舊檔
1git pull ...
(Bug)hexo生成模板時有問題
結果很單純是 文件前面的config沒有寫好
這邊是tags -[] 這個的問題
又或者忘記存檔
(Bug)Hexo 紀錄
12345node:internal/fs/promises:862 const result = await binding.readdir( ^Error: ENOENT: no such file or directory, scandir
換新電腦想說久違看一下我的部落格
結果跳BUG,不能使用,找不到資料夾甚麼的
紀錄一下
*結論 版本太高
後面用的nodejs 版本是 20.11.1
hexo 資源版本是18.17以下
重新安裝低版本nodejs.exe 就可
Leetcode#2923. Find Champion I
ProblemThere are n teams numbered from 0 to n - 1 in a tournament.
Given a 0-indexed 2D boolean matrix grid of size n * n. For all i, j that 0 <= i, j <= n - 1 and i != j team i is stronger than team j if grid[i][j] == 1, otherwise, team j is stronger than team i.
Team a will be the champion of the tournament if there is no team b that is stronger than team a.
Return the team that will be the champion of the tournament.
Example 1:
12345Input: grid = [[0,1],[0,0]]Output: 0Explanation: There ...
Leetcode#2924. Find Champion II
ProblemThere are n teams numbered from 0 to n - 1 in a tournament; each team is also a node in a DAG.
You are given the integer n and a 0-indexed 2D integer array edges of length m representing the DAG, where edges[i] = [ui, vi] indicates that there is a directed edge from team ui to team vi in the graph.
A directed edge from a to b in the graph means that team a is stronger than team b and team b is weaker than team a.
Team a will be the champion of the tournament if there is no team b that is ...
Hello World,Hexo
Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.
Quick StartCreate a new post1$ hexo new "My New Post"
More info: Writing
Run server1$ hexo server
More info: Server
Generate static files1$ hexo generate
More info: Generating
Deploy to remote sites1$ hexo deploy
More info: Deployment
Leetcode#855. Exam Room
ProblemThere is an exam room with n seats in a single row labeled from 0 to n - 1.
When a student enters the room, they must sit in the seat that maximizes the distance to the closest person. If there are multiple such seats, they sit in the seat with the lowest number. If no one is in the room, then the student sits at seat number 0.
Design a class that simulates the mentioned exam room.
Implement the ExamRoom class:
ExamRoom(int n) Initializes the object of the exam room with the number of th ...