leetcode
yichen_adf
这个人很懒~什么都没写
展开
-
leetcode个人整理
个人根据主题分类的leetcode整理using Java原创 2020-03-13 21:32:46 · 136 阅读 · 0 评论 -
leetcode15. 3Sum 16.3Sum Closest
相关主题:Array, two pointersusing Java题目15 Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which gives the sum of ze...原创 2020-03-05 16:51:32 · 106 阅读 · 0 评论 -
Java Calendar以及使用总结
写这篇博客来纪念一下leetcode177周赛翻车的第一题。第一部分是该题的分析,第二部分是Java Calendar使用以及注意点。1. 题目分析1.1 题目请你编写一个程序来计算两个日期之间隔了多少天。日期以字符串形式给出,格式为 YYYY-MM-DD1.2 思路将日期的每一项转化为int后设置Calendar, 然后使用getTimeInMillis方法获取从1970.01.01...原创 2020-02-23 16:48:52 · 214 阅读 · 0 评论 -
leetcode 5. Longest Palindromic Substring
using Java; Manacher’s Algorithm;O(N)题目Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.难度medium(难点主要在如何写一个时间复杂度O(n)的算法)步骤步骤主要参照...原创 2020-02-15 15:42:19 · 69 阅读 · 0 评论 -
leetcode 6. ZigZag Conversion
using Java; StringBuilder的使用题目The string “PAYPALISHIRING” is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibil...原创 2020-02-11 21:40:07 · 84 阅读 · 0 评论 -
leetcode 3. Longest Substring Without Repeating Characters
using Java; 最长子串问题;滑动窗口题目Given a string, find the length of the longest substring without repeating characters.难度medium(做错次数比较多,没有理解清晰滑动窗口)思路设置一个滑动窗口,一个左闭右开区间,[i,j)表示当前子串,j-i即为当前子串的长度为了使时间复杂度达...原创 2020-02-11 17:32:20 · 64 阅读 · 0 评论 -
leetcode 7. Reverse Integer
using Java,整数溢出问题题目Given a 32-bit signed integer, reverse digits of an integer.难度easy(主要问题在如何解决整数溢出)思路使用%10获得最后一位re的值,当前值x/10使用当前ans*10+re获得当前翻转值当当前值x==0时停止循环解决溢出问题,考虑ans=ans*10+re;这步可能导致溢出,...原创 2020-02-11 16:47:20 · 120 阅读 · 0 评论 -
leetcode 2. Add Two Numbers
using java;ListNode单向链表相关题目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...原创 2020-02-09 22:09:54 · 79 阅读 · 0 评论 -
leetcode 1. Two Sum (Java)
题目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 sam...原创 2020-02-09 21:23:29 · 76 阅读 · 0 评论