標籤:註冊頁面<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><meta
LeetCode,leetcodeoj題目:Divide two integers without using multiplication, division and mod operator.If it is overflow, return MAX_INT.思路:吐槽這種題目,這就像你明明可以買到過年回家的直達票,有票且一鍵解決,卻去買分段票,路途不耽誤時間嗎?而且買分段票時中間容易出差錯(bugs),最終可能回不了家(運行結果錯誤)。package
LeetCode,leetcodeoj題目:Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.思路:1)直接利用Merge two sorted lists的代碼,但逾時了。原因是這個時間複雜度太大,2n + 3n + 4n +..+ kn = O(nk^2)package list;public class MergeKSortedLists {
LeetCode,leetcodeoj題目:Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.思路:把關鍵數值對應起來,然後n-1位掃到第0位。package manipulation;import java.util.HashMap;public class RomanToInteger { public int
LeetCode,leetcodeoj題目:Implement atoi to convert a string to an integer.Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible input cases.Notes: It is intended for
圖解集合3:CopyOnWriteArrayList,初識CopyOnWriteArrayList第一次見到CopyOnWriteArrayList,是在研究JDBC的時候,每一個資料庫的Driver都是維護在一個CopyOnWriteArrayList中的,為了證明這一點,貼兩段代碼,第一段在com.mysql.jdbc.Driver下,也就是我們寫Class.forName("...")中的內容:public class Driver extends
在字串中刪除特定字元,字串刪除字元63.在字串中刪除特定的字元。題目:輸入兩個字串,從第一字串中刪除第二個字串中所有的字元。例如,輸入”They are students.”和”aeiou”, 則刪除之後的第一個字串變成”Thy r stdnts.”。 思路:1. 位元影像法 將兩個字串分別轉換成bitmap 然後對他們做異或xor運算,得到的結果即為排除了第二個字串的所有字元,