原创 LeetCode 10 — Regular Expression Matching(正則表達式匹配)

Given an input string (s) and a pattern §, implement regular expression matching with support for ‘.’ and ‘’. ‘.’ M

原创 LeetCode 3 — Longest Substring Without Repeating Characters(無重複字符的最長子串)

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

原创 LeetCode 1 — Two Sum(兩數之和)

Given an array of integers, find two numbers such that they add up to a specific target number. The function twoSum

原创 decimal format

我們經常要將數字進行格式化,比如取2位小數,這是最常見的。Java 提供 DecimalFormat 類,幫你用最快的速度將數字格式化爲你需要的樣子。下面是一個例子: [java] view plain copy importja

原创 一.快速並查集(Union_Find)

早就說要開始系統的學算法了,可總是被這個事那個事所拖累,從今天開始,認真拿着《算法》跟着coursera上的課程學算法。 算法的設計總是由API的設計開始,先將需要解決的問題抽象化,對需要的功能寫出相應的API,然後在考慮解決這個

原创 LeetCode 11 — Container With Most Water(盛最多水的容器)

Given n non-negative integers a1, a2, …, an, where each represents a point at coordinate (i, ai). n vertical lines

原创 第九屆藍橋杯國賽JavaB組——整理玩具

小明有一套玩具,一共包含NxM個部件。這些部件擺放在一個包含NxM個小格子的玩具盒中,每個小格子中恰好擺放一個部件。 每一個部件上標記有一個0~9的整數,有可能有多個部件標記相同的整數。 小明對玩具的擺放有特殊的要求:標記相同整數

原创 LeetCode 32 — Longest Valid Parentheses(最長有效括號)

Given a string containing just the characters ‘(’ and ‘)’, find the length of the longest valid (well-formed) parenth

原创 LeetCode 30 — Substring with Concatenation of All Words(與所有單詞相關聯的字串)

You are given a string, s, and a list of words, words, that are all of the same length. Find all starting indices of su

原创 LeetCode 25 — Reverse Nodes in k-Group(k個一組翻轉鏈表)

Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. k is a positive inte

原创 LeetCode 28 — Implement strStr()(實現strStr())

Implement strStr(). Return the index of the first occurrence of needle in haystack, or -1 if needle is not part of hay

原创 LeetCode 14 — Longest Common Prefix(最長公共前綴)

Write a function to find the longest common prefix string amongst an array of strings. If there is no common prefix, r

原创 leetcode題解

本文也同步發佈於我的個人網站,歡迎訪問:李智的博客 如果你有任何疑問或者建議,也歡迎聯繫我的郵箱: [email protected] 第一輪刷題,始於18年5月15日。 持續更新… 以下爲CSDN題解鏈接: 1.Two Sum(兩

原创 LeetCode 17 — Letter Combinations of a Phone Number(電話號碼的字母組合)

Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could repr

原创 LeetCode 18 — 4Sum(四數之和)

Given an array nums of n integers and an integer target, are there elements a, b, c, and d in nums such that a + b + c