摘要:Length of Last Word 这道题很简单,一般来说有两种方法 第一种就是用栈的思想,从头到尾扫描,遇到字母压栈,而遇到空格就将之前空格的全部出栈。当然出栈也有前提,就是后续必须还有元素,且非空格元素才可出栈。 第二种就是从尾部进行扫描,遇到第一个字母就加一,再直接进行统计,遇到下一个空格
阅读全文
摘要:Maximum Subarray DP问题 全称(Dynamic Programming) https://www.freecodecamp.org/news/follow these steps to solve any dynamic programming interview problem
阅读全文
摘要:###原题目```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
阅读全文
摘要:###原题目```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
阅读全文
摘要:###原题目```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
阅读全文
摘要:###原题目```cppGiven a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. An input string is
阅读全文
摘要:###原题目```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
阅读全文
摘要:####原题目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
阅读全文