leetcode
文章平均质量分 85
内推锦鲤
前端工程师
展开
-
leetcode单调栈总结
本次主要总结利用单调栈解决leetcode中的第739题每日温度、第496题下一个更大的元素I、第503题下一个更大的元素II。单调栈主要解决的几种问题:比当前元素更大的下一个元素比当前元素更大的前一个元素比当前元素更小的下一个元素比当前元素更小的前一个元素需要思考的几个问题:如何操作单调栈严格单调栈还是非严格单调栈单调递增栈还是单调递减栈先以739题为例看看如何操作单...原创 2019-11-24 15:03:18 · 898 阅读 · 0 评论 -
leetcode第二周题解整理[附github地址]
leetcode第二周题解整理removeDuplicates(删除排序数组中的重复项)解法一:双指针遍历,值覆盖题目难易程度题号removeDuplicateseasy26maxSubArrayeasy53reverseStringeasy344reverseVowelseasy345addTwoNumbersmiddle2...原创 2019-11-03 23:53:52 · 838 阅读 · 0 评论 -
leetcode第一周题解整理
leetcode第一周题解整理twoSum(两数之和)解法一:暴力方法解法二:借助哈希表,以空间换时间isValid(有效的括号)解法一:栈removeElement(移除元素)解法一:双指针遍历,头尾指针plusOne(加一)解法一:从后向前遍历singleNumber(只出现一次的数字)解法一:位运算titleToNumber(Excel表列序号)解法一:数学解法解法二:26进制rob(打家劫...原创 2019-10-20 00:42:04 · 451 阅读 · 0 评论 -
leetcode-sort-easy-over
题目列表:349350242题目349:Intersection of Two Arrays 描述:Given two arrays, write a function to compute their intersection. 例子:Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2]. Note: Each el...原创 2018-08-07 18:05:53 · 158 阅读 · 0 评论 -
leetcode-string-easy-696-788
每天坚持写几道leetcode,希望几个月后我就不再是小白 今天的题目是696,788题目:696. Count Binary Substrings描述:Give a string s, count the number of non-empty (contiguous) substrings that have the same number of 0’s and 1’s,...原创 2018-08-11 12:02:16 · 207 阅读 · 0 评论 -
leetcode-string-easy-4
每天坚持写几道leetcode,希望几个月后我就不再是小白 今天的题目是521,824,20,520 附stack string容器用法总结总结收获stack用法:empty() pop() push() size() top() string用法:append() insert() substr() append连接 basic_string ...原创 2018-08-10 12:24:00 · 191 阅读 · 0 评论 -
leetcode-array-easy-over
【53,119,213,268,414,448,485,532,561,566,581,605,628,643,665,674,697,717,724,746,747,766,830,849,867】 Given an integer array nums, find the contiguous subarray (containing at least one number) w...原创 2018-08-05 15:36:33 · 256 阅读 · 0 评论 -
leetcode-string-easy-4
每天坚持写几道leetcode,希望几个月后我就不再是小白 今天的题目是344,557,657,804总结收获unordered_map,unordered_set,map和set的区别:unordered_map存储机制是哈希表,即unordered_map内部元素是无序的。map是红黑树,map中的元素是按照二叉搜索树存储,进行中序遍历会得到有序遍历。unorder...原创 2018-08-09 11:23:04 · 227 阅读 · 0 评论 -
leetcode-Day1-Array[35,66,119]
题目:Search Insert Position难度:Easy Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in ord...原创 2018-07-22 16:06:43 · 129 阅读 · 0 评论 -
leetcode-DAY4-2018/7/25
待办: 1. set容器用法 2. 位运算题目:217. Contains Duplicate Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice...原创 2018-07-25 14:51:39 · 123 阅读 · 0 评论 -
leetcode-DAY3-2018.7.24
题目:27. Remove Element Given an array nums and a value val, remove all instances of that value in-place and return the new length. Do not allocate extra space for another array, you must do th...原创 2018-07-24 11:31:55 · 114 阅读 · 0 评论 -
leetcode-DAY2-[167,189.283]
总结今天所用到的vector的知识insert[ ] iterator insert (iterator position, const value_type& val);在position位置插入val,返回迭代器;[ ] void insert (iterator position, size_type n, const value_type& val);在posit...原创 2018-07-23 17:46:02 · 143 阅读 · 0 评论