原创 歐拉計劃 第三十九題

If p is the perimeter of a right angle triangle with integral length sides, {a,b,c}, there are exactly three solutions

原创 LeetCode 兩書之和(無序版)

Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assum

原创 LeetCode 沒有重複字符的最長子串

Given a string, find the length of the longest substring without repeating characters. Examples: Given "abcabcbb", the

原创 LeetCode 兩數之和(無序版)

Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assum

原创 歐拉計劃 第十九題

You are given the following information, but you may prefer to do some research for yourself.1 Jan 1900 was a Monday.Th

原创 數據結構 樹與二叉樹

一.樹結點的數量=邊數+1;二.二叉樹1.每個結點的度最多爲22.度爲0的結點比度爲2的結點多1個 結點的個數 = 邊的個數 + 1; N0 + N1 + N2 = N1 + 2 * N2 + 1; N0 = N2 + 1;3.前序遍歷

原创 數據結構 堆與優先隊列

完全二叉樹除了最後一層,其餘層都是滿二叉樹;最後一層只能是右側缺失1.編號爲i的子結點:左孩子編號2i;右孩子編號2 * i + 1(從1開始編號) ***[方便] 編號爲i的子結點:左孩子編號2i + 1;右孩子編號2 * i + 2

原创 數據結構 排序 不穩定排序

非穩定排序:選擇排序、快速排序 如果有兩個數字的數值大小相同,排序後的相對順序爲被改變。 一.選擇排序 1.將數組分成【已排序區】和【待排序區】 2.每一輪從【待排序區】中選擇一個最小的元素放到【已排序區】的尾部 3.直到【待排序區】沒有

原创 LeetCode兩數之和(有序版)

Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a speci

原创 歐拉計劃 第四十七題

The first two consecutive numbers to have two distinct prime factors are:14 = 2 × 715 = 3 × 5The first three consecutiv

原创 數據結構 查找 哈希表

哈希:從高維空間【信息量更大的空間】到低維空間【所能容納信息量較少的空間】的映射(會發生衝突) 衝突處理方法:4種 結構定義: size:數組大小 data_type:任意類型映射到整型 提供數組下標找值 時間複雜度O(1) #incl

原创 數據結構 順序表與鏈表

數據元素是數據的基本單位 數據元素不能再分 原子項 數據元素可以再分 組合項若干數據項組成一個數據元素數據項是數據的最小單位算法 :有窮性 確切性 輸入項 輸出項 可行性時間複雜度 : O(1) O(logn) O(n) O(nlog

原创 HTTP Web的攻擊技術

一.針對Web的攻擊技術1.HTTP不具備必要的安全功能2.在客戶端可篡改請求主動攻擊:SQL注入攻擊、OS注入攻擊攻擊者通過直接訪問Web應用,把攻擊代碼傳入攻擊模式。主要攻擊服務器上的資源被動攻擊:跨站腳本攻擊、HTTP首部注入攻擊、

原创 歐拉計劃 第二十一題

Let d(n) be defined as the sum of proper divisors of n (numbers less than n which divide evenly into n).If d(a) = b and

原创 歐拉計劃 第四十六題

prime and twice a square.9 = 7 + 2×1215 = 7 + 2×2221 = 3 + 2×3225 = 7 + 2×3227 = 19 + 2×2233 = 31 + 2×12It turns out th