LeetCode
lk1009115563
这个作者很懒,什么都没留下…
展开
-
LeetCode1218:逐步分析从最长递增子序列到最长定差子序列
按照最长递增子序列的思路dpclass Solution { public int longestSubsequence(int[] arr, int difference) { // dp[i]: arr[0~i] 中且以i结尾的最长定差子序列 int dp[] = new int[arr.length]; dp[0] = 1; int res = 1; for (int i = 1; i < arr.原创 2021-11-05 16:16:13 · 135 阅读 · 0 评论 -
java_LeetCode_3--Longest Substring Without Repeating Characters
题目;Given a string, find the length of the longest substring without repeating characters.Examples:Given "abcabcbb", the answer is "abc", which the length is 3.Given "bbbbb", the answ原创 2017-08-24 20:02:33 · 197 阅读 · 0 评论 -
LeetCode---twoSum
题目:Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution, and you may not use the sa原创 2017-08-23 19:46:58 · 171 阅读 · 0 评论 -
LeetCode_2----Add Two Numbers
题目:You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and ret原创 2017-08-23 21:09:32 · 153 阅读 · 0 评论 -
LeetCode-Palindrome Number-Java
题目:Determine whether an integer is a palindrome. Do this without extra space.转成字符串,使用额外空间的解法。注意-123321应返回falsepublic boolean isPalindrome(int x) { String string = ""+x; for(int i=0;i<s原创 2017-09-02 19:34:19 · 222 阅读 · 0 评论 -
LeetCode-Reverse Integer-Java
题目:Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321click to show spoilers.Note:The input is assumed to be a 32-bit signed integer. Your f原创 2017-09-02 19:06:49 · 216 阅读 · 0 评论