Leetcode:169. 多数元素

Given 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: Input: nums = [3,2,3] Output: 3 Example 2: Input: nums = [2,2,1,1,1,2,2] Output: 2 Constraints: n == nums.length 1 <= n <= 5 * 104 -109 <= nums[i] <=...

Leetcode:80. 删除有序数组中的重复项 II

Given 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...

Blog:奇思妙想待办项

我发现我的思维特别容易发散,就是干这一件事,脑海中突然有了其他灵感,此前的做法是“直接插队的优先队列”,就是放下手中活,把突然想到去办了,其...

Blog:Hugo写作小技巧

记录一些实用Hugo写博客的小技巧。 —— 因为如果当时不记录,那么日后肯定不会再记录的!(懒!) 使用Archetype预设模版 在使用 hugo new 命令创...

Leetcode:26删除有序数组中的重复项

Given an integer array nums sorted in non-decreasing order, remove the duplicates in-place such that each unique element appears only once. The relative order of the elements should be kept the same. Then return the number of unique elements in nums. Consider the number of unique elements of nums to be k, to get accepted, you need to do the following things: Change the array nums such that the first...

Leetcode:27移除元素

Given an integer array nums and an integer val, remove all occurrences of val in nums in-place. The order of the elements may be changed. Then return the number of elements in nums which are not equal to val. Consider the number of elements in nums which are not equal to val be k, to get accepted, you need to do the following things: Change the array nums such that...

Leetcode:88合并两个有序数组

LeetCode上“最简单”的一道题了吧? 长时间没有写过题,面试的时候竟然不会写了,奇耻大辱的一件事! You are given two integer arrays nums1 and nums2, sorted in non-decreasing order, and two integers m and n,...

Python:一个正则表达式的小例子

我想重命名一个文件(手动操作是不可能的,懒!) 将“清晰易懂的的线性代数,国立阳明交通大学周志成,国语版mit线性代数Gilbert Strang LA_1...

Python:MP4的音轨修复

又干了一件:“为了一碟醋,包了一锅饺子”的事。。。 就是重新开始学习Strang老爷子的线性代数课了,然后下载了之前国内字幕组的版本(多年不好...

博客优化:自定义字体加速显示

博客里使用了自定义的字体,最开始直接采用ttf文件加载的方式,因为博客内容全部是静态存在Github上的,这种直接加载多少有点慢,所以想了一...