C++
鲜为人知阿道夫
这个作者很懒,什么都没留下…
展开
-
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 · 184 阅读 · 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 · 129 阅读 · 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 · 276 阅读 · 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 · 355 阅读 · 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 · 189 阅读 · 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 · 161 阅读 · 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 · 286 阅读 · 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 · 447 阅读 · 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 · 196 阅读 · 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 · 113 阅读 · 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 · 918 阅读 · 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 · 347 阅读 · 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 · 263 阅读 · 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 · 347 阅读 · 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 · 398 阅读 · 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 · 551 阅读 · 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 · 332 阅读 · 0 评论 -
使用opencv转视频格式
因为需要把NV21的1080p视频转成YV12,又不知道用什么工具,所以直接写了代码可能代码有点问题,不过能实现我的要求,但还是希望各位大手子在留言区点评下。这是Ubuntu系统下的代码,可能在windows上有所不同。因为懒得弄输入法,所以当时写的是英文的注释,见谅#include <QCoreApplication>#include <opencv2/worl...原创 2018-12-28 10:50:54 · 1648 阅读 · 0 评论 -
C++ Poco库 Xml使用
这几天公司需要,研究了下Xml的使用。由于某些原因我们不能直接使用文件,于是网上很多教程就作废了。而且官方也没有相关例子,很难受。最后,研究了下源文件,终于知道了原理不废话了,先上代码。string类型到Poco::Document指针的转化#include <Poco/DOM/DOMParser.h>#include <Poco/DOM/Document.h...原创 2018-08-22 11:06:06 · 1319 阅读 · 0 评论