原创 反轉字符串

編寫一個函數,其作用是將輸入的字符串反轉過來。 示例 1: 輸入: “hello” 輸出: “olleh” 示例 2: 輸入: “A man, a plan, a canal: Panama” 輸出: “amanaP :lanac

原创 設計模式-觀察者模式

     http://ttitfly.iteye.com/blog/152512       觀察者模式定義了一種一對多的依賴關係,讓多個觀察者對象同時監聽某一個主題對象。這個主題對象在狀態上發生變化時,會通知所有觀察者對象,讓他們能夠

原创 顛倒整數

給定一個 32 位有符號整數,將整數中的數字進行反轉。 示例 1: 輸入: 123 輸出: 321 示例 2: 輸入: -123 輸出: -321 示例 3: 輸入: 120 輸出: 21 注意: 假設我們的環境只能存儲 3

原创 3的冪

給定一個整數,寫一個函數來判斷它是否是 3 的冪次方。 示例 1: 輸入: 27 輸出: true 示例 2: 輸入: 0 輸出: false 示例 3: 輸入: 9 輸出: true 示例 4: 輸入: 45 輸出: fa

原创 leetcode-141 環形鏈表(LinkedListCycle)-java

Given a linked list, determine if it has a cycle in it. Follow up: Can you solve it without using extra space? 【分析】 由於

原创 ListView的原理及性能優化

我們在做app時經常會用到列表顯示數據,ListView是我們用的最頻繁的控件,下面我將詳細講解ListView的原理及 性能優化。首先我們要清楚,要顯示一個列表需要3個元素: 1.ListView:用來展示列表的view; 2.A

原创 二叉樹的最大深度

Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the r