01 2020 档案

摘要:Plus One 问题较为简单,主要是要处理9999这种极端情况加一后的元素变化,在c++中直接可以用vector先对每个元素进行判断,如果是9,就对当前置0,再在最后对首元素置一并且再多加一个元素。 阅读全文
posted @ 2020-01-08 18:10 Yekko 阅读(97) 评论(0) 推荐(0)
摘要:Length of Last Word 这道题很简单,一般来说有两种方法 第一种就是用栈的思想,从头到尾扫描,遇到字母压栈,而遇到空格就将之前空格的全部出栈。当然出栈也有前提,就是后续必须还有元素,且非空格元素才可出栈。 第二种就是从尾部进行扫描,遇到第一个字母就加一,再直接进行统计,遇到下一个空格 阅读全文
posted @ 2020-01-06 21:56 Yekko 阅读(72) 评论(0) 推荐(0)
摘要:Maximum Subarray DP问题 全称(Dynamic Programming) https://www.freecodecamp.org/news/follow these steps to solve any dynamic programming interview problem 阅读全文
posted @ 2020-01-04 20:36 Yekko 阅读(85) 评论(0) 推荐(0)
摘要:###Add Two Number本来是一道非常简单的题目原题目的意思是,给两个链表,两个链表都链尾是十进制的头部例如有链表形式 9->8->7 对应的十进制就是789,而后的操作时将两个链表相加并且合并到一个链表里面 ###第一次的解法我第一次是被结构体卡住了,才考研完,很多基础知识全忘了,比如构 阅读全文
posted @ 2020-01-03 20:34 Yekko 阅读(141) 评论(0) 推荐(0)
摘要:###原题目```cppGiven 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 fo 阅读全文
posted @ 2020-01-01 21:56 Yekko 阅读(251) 评论(0) 推荐(0)
摘要:###原题目```cppGiven a sorted array nums, remove the duplicates in-place such that each element appear only once and return the new length. Do not alloca 阅读全文
posted @ 2020-01-01 21:54 Yekko 阅读(117) 评论(0) 推荐(0)
摘要:###原题目```cppMerge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lis 阅读全文
posted @ 2020-01-01 21:30 Yekko 阅读(133) 评论(0) 推荐(0)
摘要:###原题目```cppGiven a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. An input string is 阅读全文
posted @ 2020-01-01 21:28 Yekko 阅读(115) 评论(0) 推荐(0)
摘要:###原题目```cppWrite a function to find the longest common prefix string amongst an array of strings. If there is no common prefix, return an empty strin 阅读全文
posted @ 2020-01-01 21:24 Yekko 阅读(103) 评论(0) 推荐(0)
摘要:###原题目将I V C M 诸如此类的罗马数字输入后,转换成数字输出。```cppExampleSymbol ValueI 1V 5X 10L 50C 100D 500M 1000 Example 1: Input: "III"Output: 3Example 2: Input: "IV"Outp 阅读全文
posted @ 2020-01-01 21:22 Yekko 阅读(122) 评论(0) 推荐(0)
摘要:####原题目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 h 阅读全文
posted @ 2020-01-01 21:19 Yekko 阅读(57) 评论(0) 推荐(0)