原创 【leetcode】第一題:兩數之和(python3)

題目鏈接:https://leetcode-cn.com/problems/two-sum/ 暴力破解: class Solution: def twoSum(self, nums: List[int], target: int

原创 小算法--從一個數組中選擇固定個數的元素的所有可能

#include <iostream> using namespace std; #define Select_Num 10 void Select(int* arr, int start, int* result, int coun

原创 c++中有關String類的構造函數等

String類定義如下: class String { public: String(const char* str = NULL); String(const String &other); ~ String(void); S

原创 小算法--任意大於3的整數轉化成兩個質數和的總對數

#include <iostream> #include <cmath> #define MAX 1000 using namespace std; int main(int argc, char *argv[]) { int X;

原创 【leetcode】第四題:尋找兩個有序數組的中位數(python3)

題目鏈接:https://leetcode-cn.com/problems/median-of-two-sorted-arrays/submissions/ class Solution: def findMedianSorte

原创 【leetcode】第三題:無重複字符的最長子串(python3)

題目鏈接:https://leetcode-cn.com/problems/longest-substring-without-repeating-characters/ class Solution: def lengthOf

原创 【leetcode】第一題:兩數之和

暴力破解: class Solution: def twoSum(self, nums: List[int], target: int) -> List[int]: delValue = 0 fo

原创 【ML】奇異值分解(SVD)

SVD原理詳解及推導 https://blog.csdn.net/zhongkejingwang/article/details/43053513 SVD在推薦系統中的應用詳解以及算法推導 https://blog.csdn.net/zh

原创 數學--n與6的情愫

求證:(n-1)*n*(n+1)一定能被6整除.(n爲不小於2的整數) 證明:三個連續的整數至少有一個是偶數,那麼乘積能被2整除;            三個連續的整數有且僅有一個能被3整除;            故而(n-1)*n*(

原创 數學--n與7的情愫

求證:8^n % 7 = 1.(n爲任意自然數) 證明:(1)數學歸納法.         n = 1, 8^1 = 8, 8 % 7 = 1,成立         假設n = k時等式成立,即8^k % 7 = 1 => 8^k = 7