原创 leetcode練習 Kth Largest Element in an Array

分治稍微講了講簡單的第k大的數 就簡單的在leetcode上面練練手 題目: Find the kth largest element in an unsorted array. Note that it is the kt

原创 Unity3D(六)揹包系統

我這次只實現了一個相當簡單的揹包系統。就是點擊裝備欄,裝備欄上的貼圖會跟着鼠標走,如果有貼圖的鼠標點擊揹包欄,貼圖就會粘到揹包裏。就是一個簡單的揹包裝備。實現過程也不是很複雜,代碼不是很多,主要是佈置場景。 (而且拖入揹包上的

原创 偶然遇到的概率統計

在做計網作業,有道題描述了一個時間A發生120次,成功率爲10%,成功次數至少21次的題,促使我對這部分內容進行復習。 首先是我想得起來的概念: 二項分佈,n很大,p很小時可以近似爲泊松分佈。 …然後泊松分佈是啥東西就完全忘了

原创 leetcode練習 Course Schedul

最近一直是圖論的學習,還是找一個圖論的題目 There are a total of n courses you have to take, labeled from 0 to n - 1. Some courses may h

原创 DES密碼的思想

web安全學了些密碼系統,還講了具體算法,emmm感覺還是比較感興趣 目前主要講了DES密碼,貌似是一個不是特別優秀但是比較大衆化的密碼系統。 也是記錄在這裏,給以後的自己當個備忘錄。 目前只寫了僞代碼,打算有空的時候真正實

原创 leetcode練習 714. Best Time to Buy and Sell Stock with Transaction Fee

動態規劃感覺很重要,很鍛鍊思維。 Your are given an array of integers prices, for which the i-th element is the price of a given sto

原创 leetcode練習 Course Schedule II

之前做了Course Schedule,也是拓撲排序。 (其實做這個是水了一期 直接上題目 There are a total of n courses you have to take, labeled from 0 to

原创 leetcode學習 Merge Intervals

又是一道中等題目,本來想隨便做做,結果遇到了一些小問題,寫下來引以爲戒。 題目: Given a collection of intervals, merge all overlapping intervals. For exa

原创 leetcode練習 Task Scheduler

Given a char array representing tasks CPU need to do. It contains capital letters A to Z where different letters re

原创 leetcode練習 Add Two Numbers

感覺很久沒有接觸鏈表,又打算在處理圖的時候使用鄰接表 稍微做一道小題目熟悉一下 很簡單,權當練手,重點是後面圖的相關問題 /** * Definition for singly-linked list. * struct

原创 leetcode練習 Redundant Connection

這次是檢查冗餘的,題目主要練習無向圖中是否有環的判斷。 題目如下: In this problem, a tree is an undirected graph that is connected and has no cyc

原创 python學習筆記 (string)

關於python的字符串 Slice with [ start : end : step ] You can extract a substring (a part of a string) from a string by u

原创 leetcode試手 Reverse Integer

選了門算法分析與設計,老師推薦了leetcode網站作爲編程的練習。第一次接觸這個網站,感覺有點意思,再加上許久不打類似的題目有點生疏,選了個easy的題目試了試手,還是能找到自己的不足之處。 Reverse Integer 一

原创 leetcode改進 Reverse Pairs

昨天輕易使用sort處理感到不妥,今天仔細思考了一下,想到一種改進方案。 首先分析sort爲何不好 sort應當是O(nlogn) 的複雜度,但是那個函數裏原本是O(n)的複雜度,所以sort使得算法更加複雜,不妥,對此,我選

原创 leetcode練習 Kth Smallest Element in a Sorted Matrix

依舊對第k大的數耿耿於懷 Given a n x n matrix where each of the rows and columns are sorted in ascending order, find the kth sm