原创 【Leetcode Summary】31-35題總結

31. Next Permutation Implement next permutation, which rearranges numbers into the lexicographically next greater permu

原创 【Leetcode Summary】16-20題總結

16. 3Sum Closest Medium   Given an array nums of n integers and an integer target, find three integers in nums such tha

原创 【Leetcode Summary】26-30題總結

26.Remove Duplicates from Sorted Array Given a sorted array nums, remove the duplicates in-place such that each element

原创 【Leetcode Summary】21-25題總結

21. Merge Two Sorted Lists 把兩個有序鏈表合併。  solution:整體思想比較容易,讓兩個指針分別對應兩個鏈表的開頭,如果第一個指針對應的值比較小,那麼頭指針res的next則爲第一個指針,將第一個指針向後移

原创 【Leetcode Summary】6-10題總結

6.ZigZag Conversion The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (yo

原创 【Leetcode Summary】11-15題總結

11. Container With Most Water Given n non-negative integers a1, a2, ..., an , where each represents a point at coordina

原创 【Effective C++ Sumary】繼承和麪向對象設計

32.public繼承應該是 is a 繼承關係。試用與base class的每一件事也適用於 derived class,因爲每一個derived class 都是一個 base class 33.當我們繼承base class並加上重

原创 【Leetcode Summary】1-5題總結

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

原创 【Effective C++ Sumary】實現

26.儘量延後變量定義的出現時間,可以增加程序的清晰度並改善程序效率,因爲有的變量定義太靠前了,可能後面用不到 27.儘量少做轉型操作 C++有四個新式轉型 const_cast<T>   將對象的常良性移除(唯一有此能力的轉型符) dy

原创 【Effective C++ Sumary】資源管理

13.獲得資源後先放到對象中,因爲對象在脫離作用域後,其析構函數會保證調用,刪除堆指針。 比較好用的有auto_ptr(不好的地方在於copy行爲會導致原指針爲Null)和std::tr1::shared_ptrs 14.賦值 Resou

原创 【Effective C++ Sumary】設計與聲明

18.讓接口容易被正確使用。for example class Date { public: Date(int year,int month,int day); private: int year; int mo

原创 【Effective C++ Sumary】構造/析構/賦值運算符

5.編譯器可以默認爲class創建default構造函數,copy構造函數,copy assignment操作符,以及析構函數。 對於有const/ref的class,需要自己創建copy assignment函數 對於derived c

原创 【Effective C++ Sumary】讓自己習慣C++

1.C++是由四個部分組成的: C,面向對象C++(類,封裝,虛函數,繼承),模板C++,那個STL組成的,所以編程守則看具體使用了哪一部分。 2.對於單純常量,最好用const和enums替代#defines 對於類似函數的宏,最好用i

原创 【DirectX11】【學習筆記(15)】第一人稱攝像機

首先是一些相關的全局變量的聲明。 XMVECTOR DefaultForward = XMVectorSet(0.0f,0.0f,1.0f, 0.0f); XMVECTOR DefaultRight = XMVectorSet(1.0f

原创 【DirectX11】【學習筆記(14)】點光源

好久沒有更新博客了。。。  最近一直在忙一些其他的事情= =。。  DX都快忘了 今天繼續更新!   上次說到簡單光照,今天我們就學習一個點光源 影響點光源的因素主要有: 範圍,位置,衰減 其中衰減用一個二次方程來表達 Attenuat