原创 leetcode 16. 3Sum Closest

題目 Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. R

原创 leetcode 7. Reverse Integer

題目 Given a 32-bit signed integer, reverse digits of an integer. Example 1: Input: 123 Output: 321 Example 2: Input

原创 hdu 2089 不要62

杭州人稱那些傻乎乎粘嗒嗒的人爲62(音:laoer)。  杭州交通管理局經常會擴充一些的士車牌照,新近出來一個好消息,以後上牌照,不再含有不吉利的數

原创 正整數分組

題目描述: 2組的和相差最小。 例如:1 2 3 4 5,將1 2 4分爲1組,3 5分爲1組,兩組和相差1,是所有方案中相差最少的。 輸出 輸出這個最小差 輸入示例 5 1 2 3 4 5 輸出示例 1 import java.uti

原创 leetcode 3. Longest Substring Without Repeating Characters

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

原创 leetcode 19. Remove Nth Node From End of List

題目 Given a linked list, remove the nth node from the end of list and return its head. For example, Given linked lis

原创 leetcode 17. Letter Combinations of a Phone Number

題目 Given a digit string, return all possible letter combinations that the number could represent. A mapping of digit

原创 leetcode 9. Palindrome Number

題目 Determine whether an integer is a palindrome. Do this without extra space. 解析 class Solution { public boolean

原创 leetcode 2. Add Two Numbers

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

原创 hiho 1039:字符串消除

時間限制:1000ms 單點時限:1000ms 內存限制:256MB 描述 小Hi最近在玩一個字符消除遊戲。給定一個只包含大寫字母"ABC"的字符串

原创 LIS

題目描述: 給出長度爲N的數組,找出這個數組的最長遞增子序列。(遞增子序列是指,子序列的元素是遞增的) 例如:5 1 6 8 2 4 5 10,最長遞增子序列是1 2 4 5 10。 輸出 輸出最長遞增子序列的長度。 輸入示例 8 5 1

原创 leetcode 18. 4Sum

題目 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

原创 leetcode 1. Tow Sum

Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assu

原创 leetcode 5. Longest Palindromic Substring

題目 Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.