![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
leetcode
鲜为人知阿道夫
这个作者很懒,什么都没留下…
展开
-
Leetcode: 退格字符串比较(Backspace String Compare)(C++)
Given twostringsSandT,return if they are equal when both are typed into empty text editors.#means a backspace character.Note that afterbackspacing an empty text, the text will continue empty...原创 2020-04-30 23:11:27 · 182 阅读 · 0 评论 -
Leetcode:链表中间(Middle of the Linked List)(C++)
Given a non-empty, singlylinked list with head nodehead, returnamiddle node of linked list.If there are two middle nodes, return the second middle node.Example 1:Input: [1,2,3,4,5]Output:...原创 2020-04-30 23:06:09 · 123 阅读 · 0 评论 -
Leetcode: 最左边的列至少有一个(Leftmost Column with at Least a One)(C++)
(This problem is aninteractive problem.)A binary matrix means that all elements are0or1. For eachindividualrow of the matrix, this rowis sorted in non-decreasing order.Given a row-sorted bi...原创 2020-04-30 23:01:16 · 234 阅读 · 1 评论 -
Leetcode: 先序遍历构造二叉搜索树(Construct Binary Search Tree from Preorder Traversal)(C++)
Return the root node of a binarysearchtree that matches the givenpreordertraversal.(Recall that a binary search treeis a binary tree where for everynode, any descendant ofnode.lefthas a valu...原创 2020-04-30 22:56:38 · 352 阅读 · 0 评论 -
Leetcode: 搜索旋转排序数组( Search in Rotated Sorted Array)(C++)
Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.(i.e.,[0,1,2,4,5,6,7]might become[4,5,6,7,0,1,2]).You are given a target value to search. If found ...原创 2020-04-30 22:51:10 · 164 阅读 · 0 评论 -
Leetcode: 最小路径和(Minimum Path Sum)
Given amxngrid filled with non-negative numbers, find a path from top left to bottom right whichminimizesthe sum of all numbers along its path.Note:You can only move either down or right at a...原创 2020-04-30 22:46:59 · 157 阅读 · 0 评论 -
Leetcode: Check If a String Is a Valid Sequence from Root to Leaves Path in a Binary Tree(C++)
Given a binary tree where each path going from the root to any leaf form avalid sequence, check if a given stringis avalid sequencein such binary tree.We get the given string from the concatena...原创 2020-04-30 22:42:42 · 284 阅读 · 0 评论 -
Leetcode: 二叉树最大路径总和(Binary Tree Maximum Path Sum)(C++)
Given anon-emptybinary tree, find the maximum path sum.For this problem, a path is defined as any sequence of nodes from some starting node to any node in the tree along the parent-child connectio...原创 2020-04-30 22:37:38 · 421 阅读 · 0 评论 -
Leetcode: 有效的括号字符串(Valid Parenthesis String)(C++)
Given a string containing only three types of characters: '(', ')' and '*', write a function to check whether this string is valid. We define the validity of a string by these rules:Any left parenth...原创 2020-04-28 17:49:29 · 170 阅读 · 0 评论 -
Leetcode: 阵列除自身的乘积(Product of Array Except Self)(C++)
Given an arraynumsofnintegers wheren> 1, return an arrayoutputsuch thatoutput[i]is equal to the product of all the elements ofnumsexceptnums[i].Example:Input: [1,2,3,4]Output:...原创 2020-04-28 17:40:24 · 110 阅读 · 0 评论 -
Leetcode: 第一个唯一数字(First Unique Number)(C++)
You have a queue of integers, you need to retrieve the first unique integer in the queue.Implement theFirstUniqueclass:FirstUnique(int[] nums)Initializes the object with the numbers in the queu...原创 2020-04-28 16:40:57 · 889 阅读 · 0 评论 -
Leetcode: 子数组总和等于K(Subarray Sum Equals K)(C++)
Given an array of integers and an integerk, you need to find the total number of continuous subarrays whose sum equals tok.Example 1:Input:nums = [1,1,1], k = 2Output: 2Note:The length o...原创 2020-04-27 23:55:05 · 323 阅读 · 0 评论 -
Leetcode: 数字范围的按位与(Bitwise AND of Numbers Range)(C++)
Given a range [m, n] where 0 <= m <= n <= 2147483647, return the bitwise AND of all numbers in this range, inclusive.Example 1:Input: [5,7]Output: 4Example 2:Input: [0,1]Output...原创 2020-04-27 23:46:55 · 257 阅读 · 0 评论 -
Leetcode: 最大正方形(Maximal Square)(C++)
Given a 2D binary matrix filled with 0's and 1's, find the largest square containing only 1's and return its area.Example:Input: 1 0 1 0 01 0 1 1 11 1 1 1 11 0 0 1 0Output: 4给定一个填充有0和1...原创 2020-04-27 23:09:14 · 322 阅读 · 0 评论 -
Leetcode: 最长公共子序列(Longest Common Subsequence)(C++)
Given two stringstext1andtext2, return the length of their longest common subsequence.Asubsequenceof a string is a new string generated from the original string with some characters(can be none...原创 2020-04-27 22:54:56 · 372 阅读 · 0 评论 -
Leetcode: 跳跃游戏(Jump Game)(C++)
Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Determine if yo...原创 2020-04-27 22:44:44 · 523 阅读 · 0 评论 -
Leetcode: LRU缓存器(C++)
Design and implement a data structure forLeast Recently Used (LRU) cache. It should support the following operations:getandput.get(key)- Get the value (will always be positive) of the key if th...原创 2020-04-27 22:09:16 · 307 阅读 · 0 评论