原创 leetcode146——LRU(HashMap加雙向鏈表!!!)

老是想的是deque,然而要想想雙向鏈表的插入刪除複雜度才爲O(1)呀!!! 題目連接:https://leetcode-cn.com/problems/lru-cache/ struct BidirectionalNode {

原创 特徵提取——考map「pair「int,int」」,int」結合起來的用法

題目連接:https://www.nowcoder.com/questionTerminal/5afcf93c419a4aa793e9b325d01957e2 可以用pair<int,int>來實現雙鍵值,即通過比較pair.first,

原创 Leetcode209——長度最小的子數組(雙指針問題)

題目鏈接:https://leetcode-cn.com/problems/minimum-size-subarray-sum/ 思路:雙指針 首先兩個指針同時指向0位,beg,last 如果當前值之和大於等於s,則l循環減去nums[b

原创 leetcode16——帶絕對值的最接近三數之和

題目鏈接:https://leetcode-cn.com/problems/3sum-closest/solution/zui-jie-jin-de-san-shu-zhi-he-by-leetcode-solution/ 思路:藉助雙指

原创 leetcode139——單詞拆分(動態規劃)

題目鏈接:https://leetcode-cn.com/problems/word-break/ 首先考慮到unordered_set是基於哈希表實現的,查詢的時間複雜度爲O(1) 所以首先將wordDict中每個單詞存到set中 將d

原创 生成Cesium APP

1.首先去Cesium官網下載CesiumJS:https://cesiumjs.org/downloads/ 2.下載Visual Studio2017並安裝 Node.js,使用.NET的移動開發,使用JavaScript的移動開發相

原创 高級OpenGL之立方體貼圖——引入反射貼圖升級納米裝模型

模型加載主程序: #include <iostream> #include <glad/glad.h> #include <GLFW/glfw3.h> #include <fstream> #include <sstream> #inc

原创 Leetcode——只出現一次的字符

只出現一次的字符I:其餘字符出現兩次 直接將全部數字異或得到結果。 只出現一次的字符II:其餘字符出現三次 用seen_once=~seen_twice&(seen_once^num) 用seen_twice=~seen_once&(se

原创 高級OpenGL之模板測試

和深度測試一樣,對模板緩衝應該通過還是失敗,以及它應該如何影響模板緩衝,有一定控制。一共有兩個函數能夠用來配置模板測試: glStencilFunc和glStencilOp glStencilFunc(GLenum func, GLint

原创 leetcode1014——最佳觀光組合

題目鏈接:https://leetcode-cn.com/problems/best-sightseeing-pair/ 思路:不能採用兩重循環暴力枚舉,會超時,而應該將A[i]+A[j]+i-j拆分爲兩部分,A[i]+i,A[j]-j兩

原创 高級OpenGL之Uniform緩衝對象(高級GLSL)

使用Uniform緩衝對象畫出四個不同顏色的立方體: #include <iostream> #include <glad/glad.h> #include <GLFW/glfw3.h> #include <fstream> #incl

原创 高級OpenGL之立方體貼圖中反射

箱子反射天空盒的具體實現代碼: #include <iostream> #include <glad/glad.h> #include <GLFW/glfw3.h> #include <fstream> #include <sstrea

原创 劍指offer20題——leetcode主站65題

題目鏈接:https://leetcode-cn.com/problems/biao-shi-shu-zhi-de-zi-fu-chuan-lcof/ 思路: 1. 首先去除字符串首尾字符 2. 根據小寫e劃分指數和底數 3. 分別對指數

原创 leetcode990——並查集

class Solution { private: int fa[26]; public: int DFS(int x) { if(fa[x]!=x) fa[x]=DFS(

原创 Leetcode面試題9——根據前序和中序遍歷序列來建立二叉樹

/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode