原创 167. Two Sum II - Input array is sorted(雙向指針)

Two Sum II - Input array is sorted 【題目】 Given an array of integers that is already sorted in ascending order, find two

原创 7. Reverse Integer(注意越界問題)

Reverse Integer 【題目】 Given a 32-bit signed integer, reverse digits of an integer. (翻譯:給定一個 32 位有符號整數,將整數中的數字進行反轉。) Exam

原创 189. Rotate Array(三步旋轉法)

Rotate Array 【題目】 Given an array, rotate the array to the right by k steps, where k is non-negative. (翻譯:給定一個數組,將數組中的元素

原创 53. Maximum Subarray (Kadane算法 / 動態規劃 / 分治法)

Maximum Subarray 【題目】 Given an integer array nums, find the contiguous subarray (containing at least one number) which

原创 118. Pascal's Triangle (楊輝三角 / 暴力求解法)

Pascal's Triangle 【題目】 Given a non-negative integer numRows, generate the first numRows of Pascal's triangle. (翻譯:給定一個非

原创 119. Pascal's Triangle II

Pascal's Triangle II 【題目】 Given a non-negative index k where k ≤ 33, return the kth index row of the Pascal's triangle.

原创 深入理解字符串常量池

我們知道字符串的分配和其他對象分配一樣,是需要消耗高昂的時間和空間的,而且字符串我們使用的非常多。JVM爲了提高性能和減少內存的開銷,在實例化字符串的時候進行了一些優化:使用字符串常量池。 每當我們創建字符串常量時,JVM會首先檢查字符串

原创 B樹與B+樹的區別

我們先來看看Stack Overflow上面是怎麼解釋的(沒有梯子的,博主已經把回答copy下來了): The image below helps show the differences between B+ trees and B t

原创 【每天一道編程系列-2018.4.20】—— Sum

【題目描述】Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all

原创 【每天一道編程系列-2018.4.21】—— 過橋問題

【題目描述】今天無意中看見一道微軟面試題,很有意思,大家一起來看一下:四人夜過橋,步行時間分別爲 1、2、5、10 分鐘,四人只有一臺手電筒,一趟最多兩人過橋,一趟過橋須持手電筒,時間以最慢者計,問 17 分鐘內可否過橋,如何過橋?【本題

原创 【每天一道編程系列-2018.3.19】—— Digit Counts

【題目描述】Count the number of k's between 0 and n. k can be 0 - 9.Exampleif n = 12, k = 1 in[0, 1, 2, 3, 4, 5, 6, 7, 8, 9,

原创 【每天一道編程系列-2018.2.28】(Ans)

【題目描述】  Given n non-negative integers a1, a2, …, an, where each represents a point at coordinate (i, ai). n vertical li

原创 華爲2018年校園招聘機試題

01 括號匹配:package huawei; import java.util.Scanner; import java.util.Stack; /** * 給定一個字符串,裏邊可能包含"()"、"[]"、"{}"三種括號,請編寫

原创 【準備考試和論文,2018.3.20-2018.4.18停更,請見諒】

博主考試將至,而且近期論文要做的事情比較多,所以博主要專心備考一段時間,近一段時間【每天一道變編程系列】可能要停更一段時間了,希望大家諒解!

原创 【每天一道編程系列-2018.2.20】(Ans)

【題目描述】  The string “PAYPALISHIRING” is written in a zigzag pattern on a given number of rows like this: (you may want t