原创 Leetcode225. Implement Stack using Queues

該題和232題類似,思想上差不多232題 原題 Implement the following operations of a stack using queues. push(x) – Push element x onto

原创 Leetcode162. Find Peak Element

原題 A peak element is an element that is greater than its neighbors. Given an input array where num[i] ≠ num[i+1],

原创 Linux中基本操作命令

一、文件系統的管理 tips:輸入命令的時候要常用tab鍵來補全 ls 查看目錄信息 ( ls / ) ls -l 等價於 ll pwd 查看當前所處的路徑 cd 切換目錄 (cd /) ,如

原创 Leetcode20. Valid Parentheses

原題 Given a string containing just the characters ‘(‘, ‘)’, ‘{‘, ‘}’, ‘[’ and ‘]’, determine if the input string is

原创 【轉】Java String.split()用法小結

在java.lang包中有String.split()方法,返回是一個數組 我在應用中用到一些,給大家總結一下,僅供大家參考: 1、如果用“.”作爲分隔的話,必須是如下寫法,String.split(“\.”),這樣才能正確的分隔

原创 Leetcode118. Pascal's Triangle (楊輝三角)

原題 Given numRows, generate the first numRows of Pascal’s triangle. For example, given numRows = 5, Return [

原创 Leetcode263. Ugly Number

原題 Write a program to check whether a given number is an ugly number. Ugly numbers are positive numbers whose prim

原创 Servlet

servlet 是運行在 Web 服務器中的小型 Java 程序(即:服務器端的小應用程序)。servlet 通常通過 HTTP(超文本傳輸協議)接收和響應來自 Web 客戶端的請求。 1.1、編寫一個servlet程序: a

原创 Leetcode232. Implement Queue using Stacks

原題 Implement the following operations of a queue using stacks. push(x) – Push element x to the back of queue. pop

原创 Schema與數據類型優化

選擇優化的數據類型 更小的通常更好,更快,佔用的更少的磁盤、內存和CPU緩存,並且需要的CPU週期更短 簡單就好 儘量避免null,因爲使用null對於索引、索引統計、值比較都是比較麻煩 整數類型 有符號和無符號使用相同

原创 Leetcode345. Reverse Vowels of a String

原題 Write a function that takes a string as input and reverse only the vowels of a string. Example 1: Given s = “h

原创 HashMap Hashtable區別

http://blog.csdn.net/java2000_net/article/details/2512510 http://blog.csdn.net/shohokuf/article/details/3932967 我

原创 Java連接數據庫JDBC

一、註冊Mysql驅動 二、獲取Connection 三、創建Statement 四、查詢數據庫返回ResultSet對象 五、遍歷ResultSet輸出數據 六、關閉ResultSet、關閉Statement、關閉Co

原创 數據庫中的索引

數據庫索引的類型 哈希索引:基於哈希表實現,只有精確匹配索引所有列的查詢纔有效 B-Tree索引:適用於全值索引、健值索引或者是鍵前綴索引 索引的優點 索引大大減少服務器掃描的數據量 所以可以幫助服務器避免排序和臨時表 索引可

原创 Leetcode28. Implement strStr()

原題 Implement strStr(). Returns the index of the first occurrence of needle in haystack, or -1 if needle is not par