原创 Two Sum(C++兩數之和)

解題思路: (1)使用組合,可惜耗時比較久,笑哭 class Solution { public: vector<int> twoSum(vector<int>& nums, int target) { vect

原创 Implement Stack using Queues(C++用隊列實現棧)

解題思路: (1)類比循環鏈表,對於每一剛進入隊列的元素x,使用隊列的pop、push操作,使新進入的元素x移動到隊列的首部 class MyStack { public: /** Initialize your data st

原创 乘法(JS牛客網)

解題思路: (1)首先判斷最長的小數位數 (2)然後設置返回精度 function multiply(a, b) { var x,y; try { x = a.toString().split(".")[1].leng

原创 二進制轉換(JS)

function convertToBinary(num) { var str = num.toString(2); var len = str.length; while(len<8) { st

原创 ssd pytorch eval 報錯解決辦法

(1)本修改針對的代碼是 https://github.com/amdegroot/ssd.pytorch (2)兩處修改如下: (3)ssd.py import torch import torch.nn as nn import t

原创 Remove Duplicates from Sorted List(C++刪除排序鏈表中的重複元素)

解題思路: (1)首先設置前指針,判斷當前指針是否和前指針指向的值相同,相同則“刪除”,移向下一個指針 (2)不同,設置前指針爲當前指針,當前指針移向下一個指針 /** * Definition for singly-linked l

原创 Path Sum III(C++路徑總和 III)

原網址:https://leetcode.com/problems/path-sum-iii/discuss/91877/C%2B%2B-5-Line-Body-Code-DFS-Solution 解題思路: (1)總的數目是以當前爲根的

原创 Remove Duplicates from Sorted Array(C++刪除排序數組中的重複項)

解題思路: (1)遍歷數組,向前移動數組,覆蓋重複的元素 (2)耗時O(n*n),並不是好的方法,哈哈哈 class Solution { public: int removeDuplicates(vector<int>& s)

原创 Add to Array-Form of Integer(C++數組形式的整數加法)

解題思路: (1)先將K劃分爲數組,再使用十進制加法,記住存儲進位 (2)依次判斷從個位開始兩個數相加,再加上進位,是否大於10(是否需要進位) class Solution { public: vector<int> addT

原创 Mastering Algorithms with C(graph)

(1)graph.h /***************************************************************************** *

原创 使用 arguments(JS)

解題思路: (1)首先將類數組轉爲數組,再使用reduce方法,累計求和 function useArguments() { var result = Array.prototype.reduce.call(arguments,

原创 Subtree of Another Tree(C++另一個樹的子樹)

解題思路: (1)注意這裏的樹的子結構和劍指offer裏面定義的不一樣 (2)這裏指的是以某個節點作爲根結點,剩下的所有點值均相同,也就是說一直到最後的葉子結點 /** * Definition for a binary tree n

原创 tf.keras.layers.Conv2DTranspose中反捲積輸入和輸出關係

  函數申明:https://tensorflow.google.cn/api_docs/python/tf/keras/layers/Conv2DTranspose tf.keras.layers.Conv2DTranspose(

原创 Min Stack(C++最小棧)

解題思路: (1)設置兩個數組,一個保存原始順序,一個保存最小值 (2)注意出棧時,重新設置當前最小值 class MinStack { public: /** initialize your data structure he

原创 GeeksforGeeks(AVL)

(1)AVL插入操作          https://www.geeksforgeeks.org/avl-tree-set-1-insertion/ (2)AVL刪除操作          https://www.geeksforgee