原创 刪除元素_LintCode

給定一個數組和一個值,在原地刪除與值相同的數字,返回新數組的長度。 元素的順序可以改變,並且對新的數組不會有影響。 樣例 給出一個數組 [0,4,4,0,0,2,4,4],和值 4 返回 4 並且4個元素的新數組爲[0,0,0,

原创 aspectj

使用proxy指定劫持的class和需要的advise或者advisor advise是用來指定需要插入的內容和位置 advisor傳入advise用來指定method advise有四種形式 before: Method

原创 最接近的三數之和 _LintCode

public class Solution { /** * @param numbers: Give an array numbers of n integer * @param target : An

原创 數組剔除元素後的乘積_LintCode

public class Solution { /** * @param A: Given an integers array A * @return: A Long array B and B[i]=

原创 Mybatis學習(三)

和association差不多,就是使用的collection <mapper namespace="com.mybatis.onetomany.mapper.ClassesMapper"> <resultMap id="

原创 leetcode第二題AddTwoNumber

You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse o

原创 多線程複習(一)

新建線程的方法有三種 1、繼承Thread類 2、繼承runnable接口 3、繼承callable 執行線程的方法有兩種 1、Thread.start(); 2、ExcuteService.excute(new Thr

原创 SimpleDateFormat最簡單的使用

String str = "time"; String a = ""; Date date = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd

原创 leetcode第三題Longest Substring Without Repeating Characters

Given a string, find the length of the longest substring without repeating characters. Examples: Given “abcabcbb”,

原创 String的不可變

String是被final修飾的類,所有看起來會修改String值的方法都是創建了一個新的String對象。 所以這裏要注意的是,String類型實例的傳遞永遠是值傳遞,而不是引用傳遞如下代碼 public class Test

原创 leetcode(15)3sum

Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets i

原创 丟失的第一個正整數_LintCode

public class Solution { /** * @param A: an array of integers * @return: an integer */ pu

原创 LeetCode第四題Median of Two Sorted Arrays

There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays.

原创 牛客網劍指offer:棧的壓入彈出序列是否匹配

輸入兩個整數序列,第一個序列表示棧的壓入順序,請判斷第二個序列是否爲該棧的彈出順序。假設壓入棧的所有數字均不相等。例如序列1,2,3,4,5是某棧的壓入順序,序列4,5,3,2,1是該壓棧序列對應的一個彈出序列,但4,3,5,1,

原创 java異常語句的執行順序

try中有兩種情況: 1.try中沒有異常時,但是有return等跳轉語句,這樣會引發程序控制流離開當前的try,自動完成finally中資源的釋放。 2.try中有異常時,catch在獲取到異常之前,進行finally執行