数据结构与算法
万古长夜
这个作者很懒,什么都没留下…
展开
-
Validate Stack Sequences
Validate Stack Sequences 题目描述: Given two integer arrays pushed and popped each with distinct values, return true if this could have been the result of a sequence of push and pop operations on an initially empty stack, or false otherwise. 例子: Input: pushed原创 2022-03-16 23:55:20 · 128 阅读 · 0 评论 -
Binary Search
1、题目描述: Given an array of integersnumswhich is sorted in ascending order, and an integertarget, write a function to searchtargetinnums. Iftargetexists, then return its index. Otherwise, return-1. You must write an algorithm withO(log n)runti...原创 2022-03-03 00:13:05 · 314 阅读 · 0 评论 -
leetcode 旋转数组
1、 题目: Rotate Array Given an array, rotate the array to the right by k steps, where k is non-negative. Constraints: 1 <= nums.length <= 105 -231 <= nums[i] <= 231 - 1 0 <= k <= 105 2、解答 class Solution { public: void rotate(vector<i原创 2022-02-28 23:56:54 · 243 阅读 · 0 评论 -
Longest Common Subsequence
题目描述: Given two strings text1 and text2, return the length of their longest common subsequence. If there is no common subsequence, return 0. A subsequence of a string is a new string generated from the original string with some characters (can be none) d原创 2022-02-28 23:13:31 · 227 阅读 · 0 评论