
LeetCode
mooe1011
这个作者很懒,什么都没留下…
展开
-
LeetCode 1. Two Sum C++
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 same ...原创 2018-11-04 17:01:23 · 128 阅读 · 0 评论 -
LeetCode 299. Bulls and Cows C++ & python zip
You are playing the followingBulls and Cowsgame with your friend: You write down a number and ask your friend to guess what the number is. Each time your friend makes a guess, you provide a hint tha...原创 2019-06-03 16:12:52 · 362 阅读 · 0 评论 -
LeetCode 56. Merge Intervals C++ 比较器 与 Python 两种语言
Given a collection of intervals, merge all overlapping intervals.Example 1:Input: [[1,3],[2,6],[8,10],[15,18]]Output: [[1,6],[8,10],[15,18]]Explanation: Since intervals [1,3] and [2,6] overlaps...原创 2019-05-30 21:15:48 · 198 阅读 · 0 评论 -
LeetCode 1029. Two City Scheduling C++ 比较器 另加Python
There are2Npeople a company is planning to interview. The cost of flying thei-th person to cityAiscosts[i][0], and the cost of flying thei-th person to cityBiscosts[i][1].Return the ...原创 2019-05-16 16:39:11 · 382 阅读 · 0 评论 -
LeetCode 26. Remove Duplicates from Sorted Array C++
Given a sorted arraynums, remove the duplicatesin-placesuch that each element appear onlyonceand return the new length.Do not allocate extra space for another array, you must do this bymodifyi...原创 2019-03-28 22:18:39 · 121 阅读 · 0 评论 -
LeetCode 53. Maximum Subarray C++
Given an integer arraynums, find the contiguous subarray(containing at least one number) which has the largest sum and return its sum.Example:Input: [-2,1,-3,4,-1,2,1,-5,4],Output: 6Explanati...原创 2019-03-18 12:34:27 · 138 阅读 · 0 评论 -
LeetCode 15. 3Sum C++
Given an arraynumsofnintegers, are there elementsa,b,cinnumssuch thata+b+c= 0? Find all unique triplets in the array which gives the sum of zero.Note:The solution set must not conta...原创 2019-03-17 23:12:55 · 197 阅读 · 0 评论 -
LeetCode 7. Reverse Integer C++
Given a 32-bit signed integer, reverse digits of an integer.Example 1:Input: 123Output: 321Example 2:Input: -123Output: -321Example 3:Input: 120Output: 21Note:Assume we are dea...原创 2019-03-12 16:58:15 · 130 阅读 · 0 评论 -
LeetCode 11. Container With Most Water C++
Givennnon-negative integersa1,a2, ...,an, where each represents a point at coordinate (i,ai).nvertical lines are drawn such that the two endpoints of lineiis at (i,ai) and (i, 0). Find two...原创 2019-03-16 11:32:12 · 115 阅读 · 0 评论 -
LeetCode 4. Median of Two Sorted Arrays C++
There are two sorted arraysnums1andnums2of size m and n respectively.Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).You may assumenums1andn...原创 2019-03-07 10:54:55 · 143 阅读 · 0 评论 -
LeetCode 3. Longest Substring Without Repeating Characters C++
Given a string, find the length of thelongest substringwithout repeating characters.Example 1:Input: "abcabcbb"Output: 3 Explanation: The answer is "abc", with the length of 3. Example 2:...原创 2019-03-06 11:31:56 · 166 阅读 · 0 评论 -
LeetCode 376. Wiggle Subsequence Java
A sequence of numbers is called awiggle sequenceif the differences between successive numbers strictly alternate between positive and negative. The first difference (if one exists) may be either pos...原创 2018-05-23 18:42:05 · 258 阅读 · 0 评论 -
LeetCode 2. Add Two Numbers C++
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 return i...原创 2018-11-04 19:19:35 · 220 阅读 · 0 评论 -
LeetCode 925. Long Pressed Name Python 使用re
Your friend is typing hisnameinto a keyboard. Sometimes, when typing a characterc, the key might getlong pressed, and the character will be typed 1 or more times.You examine thetypedcharacter...原创 2019-07-03 11:13:01 · 236 阅读 · 0 评论