原创 [筆試]判斷迴文數

今天參加了恆生電子的實習生筆試,雞蛋,數據庫的完全不會,看來要看的東西還有很多啊。 筆試最後一題是寫一個算法來判斷迴文字符串,比如“ABCDCBA”。 後來重新在機子上跑了下,唉。。。果然考試的時候貌似把指針寫錯了,而且還寫的太複雜了,指

原创 [LeetCode]Pascal's Triangle II

題目: Pascal's Triangle II    Given an index k, return the kth row of the Pascal's triangle. For example, given k 

原创 [Effective C++]條款04 確定對象被使用前已先被初始化

爲內置對象進行手工初始化,因爲C++不保證初始化他們; 故最佳處理方法:永遠在使用對象是錢先將它初始化 int x = 0;//對int進行手工初始化 const char *text = "A C-style string"; /

原创 [Effective C++]條款02 儘量以const,enum,inline替換#define

“寧可以編譯器替換預處理器” 1.對於單獨常量,最好以const對象或者enums替換#defines    即:不要使用 #define ASPECT_RATIO 1.653   原因:所使用的名稱可能並未進入記號表(symbol

原创 [數據結構與算法]各種排序算法的穩定性和時間複雜度小結

排序 選擇排序、快速排序、希爾排序、堆排序不是穩定的排序算法, 冒泡排序、插入排序、歸併排序和基數排序是穩定的排序算法。 冒泡法: 這是最原始,也是衆所周知的最慢的算法了。他的名字的由來因爲它的工作看來象是冒泡: 複雜度爲O(n*n)。

原创 [LeedCode]Swap Nodes in Pairs

題目: Swap Nodes in Pairs    Given a linked list, swap every two adjacent nodes and return its head. For example, G

原创 [LeetCode]Balanced Binary Tree

題目: Balanced Binary Tree   Given a binary tree, determine if it is height-balanced. For this problem, a height-b

原创 [LeetCode]Merge Two Sorted Lists

題目: Merge Two Sorted Lists Merge two sorted linked lists and return it as a new list. The new list should b

原创 [Effective C++]條款03:儘可能使用const

關鍵字const出現在星號*左邊,表示被指物是常量; 如果出現在星號*右邊,表示指針自身是常量; 如果出現在星號*兩邊,表示被指物和指針兩者都是常量。 char greeting[] = “Hello”; char *p = gree

原创 [LeetCode]Remove Element

題目: Remove Element   Given an array and a value, remove all instances of that value in place and return t

原创 [LeetCode]Remove Duplicates from Sorted Array II

題目: Remove Duplicates from Sorted Array II Follow up for "Remove Duplicates": What if duplicates are allowed at m

原创 [LeetCode]Roman to Integer

題目: Roman to Integer Given a roman numeral, convert it to an integer. Input is guaranteed to be within the

原创 爲Notepad++配置C/C++、C#、Java、Python編譯環境

本文轉自:http://blog.csdn.net/freewaywalker/article/details/8005468 如果只是測試小程序可以用這種方法 比較方便,如果對於大程序建議使用專業的IDE。 經常需要寫一些小程序來運行

原创 [LeetCode]Integer to Roman

題目: Integer to Roman   Given an integer, convert it to a roman numeral. Input is guaranteed to be within th

原创 [LeetCode]Remove Duplicates from Sorted Array

題目: Remove Duplicates from Sorted Array Given a sorted array, remove the duplicates in place such that each eleme