原创 LeetCode : 4. Median of Two Sorted Arrays 兩個有序數組的中值

試題 There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arra

原创 tensorflow中的dataset API

來源 1.數據導入 tf.data API可以讓你以簡單可複用的方式構建複雜的Input Pipeline。例如:一個圖片模型的Pipeline可能會聚合在一個分佈式文件系統中的多個文件,對每個圖片進行隨機擾動(random pertur

原创 美團 鍵盤大小寫轉換 最小敲擊次數

試題: 對於A,可以使用shift+A方式2次敲擊實現輸入;也可以使用caps lock先鎖定大小寫,然後再敲擊A,2次敲擊實現。注意大寫鎖定情況下,按shift + A可以實現小寫a的輸入。求解,給定字符串情況下,至少需要多少次

原创 C++ Primer中小細節 章節二:C++基礎

endl: 調試時加上能夠刷新緩衝區; 測試時可以使用excu <infile >outfile來文件重定向 類型選擇: 1、明確數值不爲負時選擇無符號; 2、一般選擇int,超過int選擇long long; 3、浮點運算選擇d

原创 LeetCode: 932. Beautiful Array 完美序列滿足A[k] * 2 = A[i] + A[j]

試題 For some fixed N, an array A is beautiful if it is a permutation of the integers 1, 2, …, N, such that: For ever

原创 LeetCode : 912. Sort an Array 排序 堆排 快排 歸併

試題 Given an array of integers nums, sort the array in ascending order. Example 1: Input: [5,2,3,1] Output: [1,2,3,5

原创 LeetCode : 93. Restore IP Addresses恢復ip

試題 Given a string containing only digits, restore it by returning all possible valid IP address combinations. Examp

原创 C++ Primer中小細節 章節三:C++標準庫

IO類型: 頭文件: 流讀取寫入:iostream 文件讀取寫入:fstream string讀取寫入:sstream io類型不可拷貝和賦值,因此無法用於形參或返回類型,而通常以引用方式傳遞。讀寫一個io對象會改變其狀態,因此

原创 LeetCode : 973. K Closest Points to Origin K個距離遠點最近的數

試題 We have a list of points on the plane. Find the K closest points to the origin (0, 0). (Here, the distance betw

原创 輔助讀懂Top-K Off-Policy Correction for a REINFORCE Recommender System

基礎知識準備 強化學習入門簡單實例 DQN 強化學習入門 第一講 MDP 隨筆分類 - 0084. 強化學習 目標函數 首先需要定義目標函數來優化模型參數,此處使用的REINFORCE算法解決RL問題: 求導證明參考 OFF-P

原创 編譯和鏈接那點事

留檔 有位學弟想讓我說說編譯和鏈接的簡單過程,我覺得幾句話簡單說的話也沒什麼意思,索性寫篇博文稍微詳細的解釋一下吧。其實詳細的流程在經典的《Linkers and Loaders》和《深入理解計算機系統》中均有描述,也有國產的諸如《程序員

原创 強化學習算法僞代碼對比

基礎公式 來源 累計回報: 在t時刻狀態下選擇行爲所獲得累計回報,其中每個R都是個隨機變量。 狀態價值函數: 狀態s下的累計回報是多維隨機變量,服從pi分佈,因此使用期望累計回報表示該狀態的價值。 其貝爾曼方程爲: 狀態

原创 tensorflow 建個小圖

def Dataset(file_pattern, batch_size, num_epochs=1): logging.info('Creating Dataset from %s', file_pattern)

原创 Go初學入門之官方文檔摘要

包 package main //程序啓動於main包 import ( "fmt" "math/rand" //包的名字與引入路徑的最後一個元素相同 ) import "math" func main() { fm

原创 sublime事項

插件列表: Package Control 包管理 Pretty JSON json格式美化 sublimerge 文檔並排比較 tap爲4space: 配置文件設置: "