原创 leetcode198 House Robber

You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stash

原创 LeetCode215. Kth Largest Element in an Array

Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not

原创 LeetCode374. Guess Number Higher or Lower

We are playing the Guess Game. The game is as follows: I pick a number from 1 to n. You have to guess which number

原创 LeetCode322. Coin Change

You are given coins of different denominations and a total amount of money amount. Write a function to compute the

原创 理解CGI、FCGI、php-cgi、php-fpm的概念

CGI:common gateway interface 通用網關接口 FCGI:fast common gateway interface 快速通用網關接口 PHP-FPM:PHP-Fast CGI Process Manage

原创 LeetCode34. Search for a Range

Given a sorted array of integers, find the starting and ending position of a given target value. Your algorithm’s

原创 01揹包問題

小偷有一個容量爲W的揹包,有n件物品,第i個物品價值vi,且重wi 目標: 找到xi使得對於所有的xi = {0, 1} sum(wi*xi) <= W, 並且 sum(xi*vi)最大 遞歸代碼 package org.fa

原创 小兵向前衝

小兵向前衝 N*M的棋盤上,小兵要從左下角走到右上角,只能向上或者向右走,問有多少種走法? 注意:這裏說的N*M是指線段,而不是指幾根豎線,幾根橫線。線段總是比線少1個的。下面的討論都是基於線段的。 見下圖(這個圖是4*4的)

原创 斐波那契數列與n!

斐波那契數列 實現斐波那契數列 0、1、1、2、3、5、8、13、21、34、…… F(0)=0,F(1)=1,F(n)=F(n-1)+F(n-2)(n≥2,n∈N*) 遞歸實現: package org.fan.learn.

原创 由常量池 運行時常量池 String intern方法想到的(四)之 常量池

這篇文章 由常量池 運行時常量池 String intern方法想到的(三)之String內存模型 有網友評論,主要有以下兩個問題: (1)是不是每個類都有一個運行時常量池? (2)在運行時常量池中存在的字符串是否是對象

原创 程序11-先升序後降序返回最大值

一個數列,先升序後降序,返回最大值的下標。 package org.fan.learn; /** * Created by fan on 2016/10/10. */ public class BinarySearchMei

原创 leetcode 72. Edit Distance

Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operati

原创 關於int和Integer互轉的問題

int轉成Integer 這個在轉換的過程中會調用Integer的靜態方法valueOf()方法。 源碼如下: /** * Returns an {@code Integer} instance represe

原创 使用JSP顯示錶格

最近在工作中需要做些前端的工作,當然還是比較low,使用的JSP。之前沒做過,遇到了一些問題,這裏記錄下。 將後端傳過來的List使用表格顯示時,免不了要使用 <c:forEach> </c:forEach> 要使用這個功能,需

原创 LeetCode278. First Bad Version

You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version