![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
leetcode
文章平均质量分 91
客院载论
I'm a coder!!
展开
-
秋招突击——7/6——复习{前K个高频元素}——新作{数据流的中位数、有效括号、最小栈、字符串解码}
那个优先队列,第一遍写,就没有写对过,还是写错!不过没事,多练练!优化了差不多两个半小时,学习算法,以后要是笔试没过,得气死,这个投入产出比的效率太低了,还是得严格按照时间要求来做,不然根本跟不上!服了,服了,今天不该摆烂的,写到差不多半夜,今天的任务才算是完成了,不行呀,项目那里就完成了多机竞争的章节,还不够呀,不行,最迟到下周结束,我得把这个项目搞定,从本周开始,后续都是一天做两道新的题目,然后复习三道题目,不能再花那么多时间了。调整一下!还是得抓住基础!!原创 2024-07-07 01:41:10 · 925 阅读 · 0 评论 -
秋招突击——7/5——复习{}——新作{跳跃游戏II、划分字母区间、数组中的第K个大的元素(模板题,重要)、前K个高频元素}
大概测了一下,发现自己做一道题,加上修改的总结的时间是超过了50分钟的,有点吓人,一天得花多少时间是用来做算法题。还是得快一点。可以,今天的效率蛮快的,在十一点就完成了算法题的内容,下面再补充一下关于设计模式的相关知识,然后下午就看一下我们的项目了。加油,冲 !剑走偏锋呀,感觉自己的路子不对,很多东西都没有专门走过,所以就会有很多问题,现在得转换一下思路,项目的代码我看的不是很懂,那就要从不是很懂的地方一点点开始看,一点点开始弄。现在欠缺了太多东西,后续还要增加每天一样的知识补充。其实很多东西,都是要花原创 2024-07-06 00:58:39 · 741 阅读 · 0 评论 -
秋招突击——7/4——复习{}——新作{最长公共子序列、编辑距离、买股票最佳时机、跳跃游戏}
今天的进度有点慢了,为什么会这么慢,上午就刷了两道题,是因为什么?中间洗了一下衣服,然后刷了一会视频,不行,还是有点来不及。下午吃饭快点,多留点时间。真的难呀,一天天的,不如开机重启!难受呀,晚上两道题,没有一道题是按时AC的,那道简单题还看错题目了,然后花了很多时间,结果简答的思路都没有考虑到。不过无所谓了,学到了,练习到了,今天又刷了四道题,明天继续加油!原创 2024-07-05 00:50:09 · 843 阅读 · 0 评论 -
秋招突击——7/2——复习{}——新作{分割等和子集、不同路径、最小路径和、最长回文子串}
目前来看,总是在最后快结束的时候,才把这些题目昨晚,总是会出点问题,很难受。对于函数的越界考虑的不够充分,最后的异常根据他给的条件又不好找。然后还有一个问题就是,最后的输出总是会输出,不要总是关注于平时的过程,还要关注于最终的输出。一个上午,基本上就背了八股,然后做了两道题目,还是不够,有点欠缺,得继续加油加油,进度太慢了!明天腾讯复试,能不能进都无所谓了,现在好好准备秋招吧。马上提前批就开始了。今天基本上关于迷宫路径的题目都做完了,整体看起来还不错,挺顺利的今天到此为止吧,累了,明天还得早起背书,准原创 2024-07-03 00:37:36 · 609 阅读 · 0 评论 -
每日一题——自动补全——1972
每日一题——自动补全原创 2022-08-20 22:37:16 · 260 阅读 · 0 评论 -
LeetCode——26 Remove Duplicates from Sorted Array
文章目录题目描述测试样例题目描述Given an integer array nums sorted in non-decreasing order, remove the duplicates in-place such that each unique element appears only once. The relative order of the elements should be kept the same.现给出一个整型数组nums,他是非递减的顺序,清除重复的元素,使得每原创 2021-09-18 20:05:44 · 145 阅读 · 0 评论 -
LeetCode-23 Merge k Sorted Lists
文章目录题目描述测试样例思路分析实现源码事故现场第一次提交分析总结题目描述You are given an array of k linked-lists lists, each linked-list is sorted in ascending order.现给你一个已经排过序的链表的数组,每一个链表都是按照升序进行排列的。Merge all the linked-lists into one sorted linked-list and return it.将所有的链表连接成一个链表,然后原创 2021-09-14 20:11:17 · 80 阅读 · 0 评论 -
LeetCode——21 MergeTwo Sorted Lists(链表使用递归操作,我是很不熟练的,希望能够多加学习)
文章目录题目描述测试样例思路分析实现源码事故现场第一次提交第二次提交第三次提交借鉴学习分析总结题目描述Merge two sorted linked lists and return it as a sorted list. The list should be made by splicing together the nodes of the first two lists.将两个已经排过序的链表合并成一个,然后返回一个已经排过序的链表。这个链表应该是通过插接两个链表的节点实现的,不能额外申请空原创 2021-09-14 16:20:16 · 155 阅读 · 0 评论 -
LeetCode——22 Generate Parentheses
文章目录题目描述测试样例思路分析实现源码事故现场分析与总结题目描述Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.先给出n对括号,构建一个函数,能够生成所有正确可能的组合测试样例Example 1:Input: n = 3Output: ["((()))","(()())","(())()","()(())","()()原创 2021-09-14 11:07:40 · 114 阅读 · 0 评论 -
LeetCode——20 Valid Parentheses
文章目录题目描述测试样例约束思路分析实现源码事故现场第一次提交第二次提交第三次提交分析与总结题目描述Given a string s containing just the characters ‘(’, ‘)’, ‘{’, ‘}’, ‘[’ and ‘]’, determine if the input string is valid.现给出一个字符串S,仅仅包含 ‘(’, ‘)’, ‘{’, ‘}’, ‘[’ 和 ‘]’,判定这个字符串是否有效。An input string is原创 2021-09-13 23:21:32 · 148 阅读 · 0 评论 -
Leetcode——Swap Nodes in Pairs——链表中的递归操作,惊到我了,多学习
文章目录题目描述测试样例题目描述Given a linked list, swap every two adjacent nodes and return its head. You must solve the problem without modifying the values in the list’s nodes (i.e., only nodes themselves may be changed.)现给出一个链表,交换每两个相邻的结点,并且返回最终的头节点。你必须是交换结点,而不是仅原创 2021-08-26 15:45:52 · 178 阅读 · 0 评论 -
Leetcode——Swapping Nodes in a Linked List
文章目录题目描述测试样例思路分析具体实现事故现场题目描述You are given the head of a linked list, and an integer k.Return the head of the linked list after swapping the values of the kth node from the beginning and the kth node from the end (the list is 1-indexed).现给出一个链表的头结原创 2021-08-23 11:32:39 · 160 阅读 · 0 评论 -
Leetcode——19 Remove Nth Node From End of List——主函数中创建链表(不能成功实现)
文章目录题目描述测试样例思路分析事故现场第一次提交第三次提交题目描述Given the head of a linked list, remove the nth node from the end of the list and return its head.现给一个链表的头节点,清楚从尾节点开始计算的第n个节点,并返回结果的头节点测试样例example1Input: head = [1,2,3,4,5], n = 2Output: [1,2,3,5]example 2原创 2021-08-22 11:25:17 · 216 阅读 · 0 评论 -
LeetCode——Target Sum——回溯算法和动态规划——alloc-and-mismatch——对于无后效性和重复子问题的最好讲解
文章目录题目描述测试样例题目描述You are given an integer array nums and an integer target.You want to build an expression out of nums by adding one of the symbols ‘+’ and ‘-’ before each integer in nums and then concatenate all the integers.For example, if nums原创 2021-07-19 09:36:37 · 413 阅读 · 1 评论 -
Leetcode——Combination Sum II——回溯算法实现
文章目录题目描述测试样例回溯解决思路分析题目描述Given a collection of candidate numbers (candidates) and a target number (target), find all unique combinations in candidates where the candidate numbers sum to target.Each number in candidates may only be used once in the co原创 2021-07-08 15:05:45 · 145 阅读 · 0 评论 -
Leetcode——Combination Sum——使用回溯算法实现
文章目录题目描述输入样例约束constraints回溯解决思路分析题目描述Given an array of distinct integers candidates and a target integer target, return a list of all unique combinations of candidates where the chosen numbers sum to target. You may return the combinations in any order原创 2021-07-08 10:41:01 · 177 阅读 · 1 评论 -
Letter Combinations of a Phone Number——heap-buffer-overflow和SEGV on unknown address
文章目录题目描述测试样例思路分析题目描述Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent. Return the answer in any order.A mapping of digit to letters (just like on the telephone buttons) is gi原创 2021-07-06 09:09:51 · 242 阅读 · 0 评论 -
Leetcode——3Sum Closet——暴力回溯
文章目录题目描述测试样例约束思路分析第一种方法,暴力回溯题目描述Given an array nums of n integers and an integer target, find three integers in nums such that the sum is closest to target. Return the sum of the three integers. You may assume that each input would have exactly one solu原创 2021-07-02 14:12:25 · 259 阅读 · 0 评论 -
Leetcode——4Sum( **returnColumnSize到底是啥)(load of null pointer of type int *(_Seriakizer_.c)异常原因和处理方法)
文章目录题目描述方法一、BruteForce题目描述Given an array nums of n integers and an integer target, are there elements a, b, c, and d in nums such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target.现给一个n个整数的整型数组和一个整型的目标数,原创 2020-09-19 14:35:48 · 597 阅读 · 1 评论 -
Leetcode——Two Sum IV - Input is a BST(unindent does not match any outer indentation level异常处理)
文章目录题目描述题目描述Given a Binary Search Tree and a target number, return true if there exist two elements in the BST such that their sum is equal to the given target.现给一个二叉搜索树和一个目标数,如果在二叉搜索树上存在两个数加起来为目标数,就返回真Example 1:Input: 5 / \ 3 6 / \ \2原创 2020-09-15 16:00:46 · 255 阅读 · 0 评论 -
Leetcode——Two Sum II ——Input array is sorted(包含三种方法,你想到的都有)
two sum 同系列的几道题,对于处理这类问题具有很强的借鉴性,改变不同的条件,来创造不同的难度,但是方法都很有启迪性原创 2020-09-14 10:57:30 · 176 阅读 · 0 评论 -
Leetcode——3Sum(解决问题的思路,参考他人的代码的优化,以及错误的解决方式)
题目描述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 zero.现给一个n个整数的数组,找找看其中有没有三个数加起来为0。找到其中所有的不同的所有组,每组由三个数构成,并且三个数之和为0Note:The solution set must原创 2020-09-12 10:39:28 · 441 阅读 · 1 评论 -
Leetcode——Longest Common Prefix(runtime error以及处理方式,使用C语言实现)(char **究竟表示什么)
题目描述Write a function to find the longest common prefix string amongst an array of strings.写一个函数,找到一个字符串数组中的最长的共有的前缀If there is no common prefix, return an empty string “”.如果没有公共前缀,返回一个空的字符串“”Example 1: Input: ["flower","flow","flight"] Output: "fl"原创 2020-08-28 11:11:42 · 302 阅读 · 0 评论 -
Leetcode——做题经验总结
常用的思考方法一:由简入繁,先是简化问题的条件或者简化问题的输入,由最初的一个,或者两个,再到后来的很多。注意总结其中的临界情况,往往临界情况对解决问题具有很重要的意义例子:其实是一道很简单的题目,但是用C语言实现起来会比较费劲,其中就有很多特殊临界情况:空的集合[] , [“aaaaa…”,“aaaaa…”,…]数量极多的项,并且每一项都是相同的,增加了程序运行的内存,造成运行的溢出。编写程序的方法:很多程序的方法并不是一开始就想明白的,脑袋中只是有一个大概的印象,但.原创 2020-08-28 09:54:23 · 254 阅读 · 0 评论 -
Leetcode——Integer to Roman(这不仅仅是一道题,更多是关于指针和地址的运用以及动态存储空间的申请,绝对值得借鉴一下)
题目简介Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M.罗马数字是用七个不同的标志表示:I, V, X, L, C, D 和M.Symbol ValueI 1V 5X 10L 50C 100D 500M原创 2020-08-26 15:00:12 · 168 阅读 · 0 评论 -
Leetcode——Roman to Integer(有分析,有改良,请进)
题目描述Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M.罗马数字是用七个不同的标志表示:I, V, X, L, C, D 和M.Symbol ValueI 1V 5X 10L 50C 100D 500M原创 2020-08-25 16:10:36 · 191 阅读 · 0 评论 -
Leetcode——Trapping Rain Water
题目描述Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.给出n个非负整数,表示一个立面图,每一个条形图的宽度是1,计算下雨之后这个条形图能够存多少水The above elevation map is represented by array [0,1原创 2020-08-24 17:46:40 · 285 阅读 · 0 评论 -
Leetcode——Container With Most Water
题目简介Given n non-negative integers a1, a2, …, an , where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Find two lines, which together with x-axis forms a container,原创 2020-08-23 15:53:30 · 236 阅读 · 0 评论 -
Leetcode——Regular Expression Matching
题目描述Given an input string (s) and a pattern §, implement regular expression matching with support for ‘.’ and ‘*’.给定一个字符串s和匹配的模板p,使用“.”和“*”,实施正则表达式的匹配‘.’ Matches any single character.‘*’ Matches zero or more of the preceding element.The matching shoul原创 2020-08-22 11:30:56 · 213 阅读 · 0 评论 -
Leetcode—— Palindrome Number
题目描述Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.判定一个整型的数字是否是回文。一个回文的正数正反读过来都是相同的Example 1:Input: 121Output: trueExample 2:Input: -121Output: falseExplanation: From left to rig原创 2020-08-18 15:23:01 · 191 阅读 · 0 评论 -
Leetcode——String to Integer (atoi)
题目描述Implement atoi which converts a string to an integer.实现atoi,将字符串转成对应的整型The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from this character, takes an optional in原创 2020-08-17 14:59:53 · 162 阅读 · 0 评论 -
Leetcode——Reverse Integer
问题描述Given a 32-bit signed integer, reverse digits of an integer.假如给你一个32位的有符号整数,将该整数的各个数位反转Example 1:Input: 123Output: 321Example 2:Input: -123Output: -321Example 3:Input: 120Output: 21Note:Assume we are dealing with an environment which could原创 2020-08-14 15:27:58 · 152 阅读 · 0 评论 -
LeetCode——Median of Two Sorted Arrays
看到这个题,坑定有很多东西都忘记了吧!没事!进来就行了,你不会的差不多我也不会,我都有解释清楚,进来吧!一块成长进步!哈哈!做完了,第一次得到那么高的评价!一下子高兴过头了,回头来发现自己还是那么差其实还是挺难的,我看半天都没看懂原创 2020-05-03 23:51:09 · 265 阅读 · 0 评论 -
LeetCode— Longest Substring Without Repeating Characters(应该全是比较全的,有思路分析)
有思路分析,有图示,相当于带你debug一遍,但是有图更清晰。方法应该也是比较全的原创 2020-05-02 00:20:10 · 308 阅读 · 0 评论 -
LeetCode——Add Two Numbers(好久没碰java了)
问题描述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...原创 2020-05-01 11:54:10 · 204 阅读 · 0 评论 -
LeetCode之零的组合(绝对是最全的,最详细的,坑完全都跳过了)
LeetCode之零的组合题目描述0的组合(10分)题目内容:给定一个包含若干个整数(可能存在重复整数)的列表,判断其中是否存在三个元素a,b,c,使得a+b+c=0?找出所有满足条件且不重复的这样的三个数的组合。输入格式:共一行,列表中元素以空格隔开。输出格式:共一行,为不重复组合的个数,不存在这样的组合就输出0输入样例:-1 0 1 2 -1输出样例:2(注:两个组合...原创 2020-04-28 09:07:47 · 639 阅读 · 0 评论 -
LeetCode——回文字符串(里面得坑我全踩了)
题目描述题目内容:给定一个字符串,判断它是否是回文字符串(即类似于peep, 12321这样的对称字符串),如果是输出True,不是则输出False。判断过程中假定只考虑字母和数字字符,而且忽略字母的大小写和其它符号(如空格、标点符号等)。输入格式:共一行,为一个字符串。输出格式:共一行,为True或False。输入样例:love e vol;输出样例:True时间限制:5...原创 2020-04-27 09:35:23 · 448 阅读 · 0 评论 -
LeetCode-HappyNumber
LeetCode_HappyNumber题目描述Write an algorithm to determine if a number n is “happy”.写一个算法去判定一个数字是否是快乐的A happy number is a number defined by the following process: Starting with any positive integer, ...原创 2020-04-25 13:59:00 · 185 阅读 · 0 评论 -
LeetCode——Two Sum(虽然简单,但是有很多的方法和技巧,有助于解决ThreeSum)
题目描述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 s...原创 2020-04-25 00:04:45 · 369 阅读 · 0 评论 -
LeetCode之SingleNumber
SingleNumber描述Given a non-empty array of integers, every element appears twice except for one. Find that single one.给出一个非空的整型数组,每一个元素出现两次,仅仅有一个元素出现一次,找到那个唯一的Note:Your algorithm should have a line...原创 2020-04-24 15:27:38 · 231 阅读 · 0 评论