矩阵leetcode 100 240
LeetCode
# 字符串 #### 左旋转字符串 [剑指 Offer 58 - II. 左旋转字符串](https://leetcode.cn/problems/zuo-xuan-zhuan-zi-fu-chuan-lcof/description/?envType=study-plan-v2&envId=cod ......
leetcode: TC of top-down memorization
example to explain how to calculate Time Complexity the memo size means each state will be calculated only once how about the TC in each state? class ......
旋转矩阵
[toc] ## 旋转的表示 在三维坐标系中,有三种表达形式 1. 旋转矩阵 $$ R = \begin{bmatrix} r_{11} & r_{12} & r_{13} \\ r_{21} & r_{22} & r_{23} \\ r_{31} & r_{32} & r_{33} \end{bm ......
旋转矩阵与欧拉角
# 旋转矩阵与欧拉角 > > 参考文献: > [Computing Euler angles from a rotation matrix ——Gregory G. Slabaugh] ## 三个主轴的旋转矩阵 右手坐标系,逆时针转动角度为正(右手螺旋定则确定)。 关于绕 $x$ 轴旋转 $\psi ......
[转]Clion中如何使用矩阵库eigen
CMakelist文件内容如下: cmake_minimum_required(VERSION 3.2) project(PISO) set(CMAKE_CXX_STANDARD 14) include_directories(C:/Users/DELL/Downloads/eigen-3.3.8) ......
【leetcode】剑指-68.1 二叉搜索树的最近公共祖先
## 思路 首先保证传入的p.valroot.val`: goto right tree ## 代码 第一版,递归法 ``` class Solution { public: TreeNode* get_ancestor(TreeNode* root, TreeNode* p, TreeNode* ......
leetcode2235 两整数相加
题目描述:(这第一种方法我就不多说了,肯定是有手就行) 给你两个整数 num1 和 num2,返回这两个整数的和。 示例 1: 输入:num1 = 12, num2 = 5 输出:17 解释:num1 是 12,num2 是 5 ,它们的和是 12 + 5 = 17 ,因此返回 17 。 示例 2: ......
Leetcode 146 LRUCache
```c /* * * Copyright (C) 2023-08-18 13:51 zxinlog * */ #include #define N 1000 // 普通Node typedef struct Node { int key; int value; struct Node *prev; ......
【LeetCode1384. 按年度列出销售总额】MySQL使用with recursive根据开始日期和结束日期展开为多行
# 题目地址 https://leetcode.cn/problems/total-sales-amount-by-year/description/ # 代码 ``` WITH RECURSIVE DateSeries AS ( SELECT product_id, period_start AS ......
【LeetCode2199. 找到每篇文章的主题】字符串处理题,使用MySQL里的group_concat和LOCATE函数完成
# 题目地址 https://leetcode.cn/problems/finding-the-topic-of-each-post/description/ # 代码 ``` with t1 as( select p.*, k.* from Posts p left join Keywords k ......
Leetcode 142. 环形链表II(Linked list cycle ii)
[题目链接](https://leetcode.cn/problems/linked-list-cycle-ii) 给定一个链表的头节点head, 返回链表开始入环的第一个节点。. 如果链表无环, 则返回 null. 如果链表中有某个节点, 可以通过连续跟踪next指针再次到达, 则链表中存在环. ......
【LeetCode2118. 建立方程】 group_concat指定分隔符,指定排序顺序
[TOC] # 题目地址 https://leetcode.cn/problems/build-the-equation/description/ # 题目描述 ``` Example 2: 输入: Terms 表: + + + | power | factor | + + + | 4 | -4 | ......
【LeetCode1225. 报告系统状态的连续日期】MySQL使用lag,lead得到连续段的:开始标志,结束标志,分组号,长度
[TOC] # 题目地址 https://leetcode.cn/problems/report-contiguous-dates/description/ # 题目描述 A system is running one task every day. Every task is independen ......
【LeetCode173. 最多连胜的次数】MySQL用户变量编程解法
[TOC] # 题目地址 https://leetcode.cn/problems/longest-winning-streak/description/ # 题目描述 选手的 连胜数 是指连续获胜的次数,且没有被平局或输球中断。 编写解决方案来计算每个参赛选手最多的连胜数。 结果可以以 任何顺序 ......
【LeetCode1454. 活跃用户】MySQL 用户自定义变量,面向过程编程解决"连续天数"的问题
[TOC] # 题目地址 https://leetcode.cn/problems/active-users/description/ # 题目描述 活跃用户 是指那些至少连续 5 天登录账户的用户。 编写解决方案, 找到 活跃用户 的 id 和 name。 返回的结果表按照 id 排序 。 # 代 ......
leetcode刷题日记
unordered_set散列哈希表:[C++ STL unordered_set容器完全攻略 (biancheng.net)](http://c.biancheng.net/view/7250.html) unordered_map:[详细介绍C++STL:unordered_map - 朤尧 - ......
P6772 [NOI2020] 美食家 题解(矩阵加速图上dp常用思路)
# P6772 [NOI2020] 美食家 题解(矩阵加速图上dp常用思路) ## 简要题面 给定一张 $n$ 个点 $m$ 条单向边的图,走这条边需要花费 $w_i$ 的时间(以天为单位),现在有一个人从 $1$ 号点出发,最后回到 $1$ 号点,要求走了 **恰好** 为 $T$ 天。 每经过一 ......
Leetcode 160. 链表相交(Intersection of two linked lists lcci)
[题目链接](https://leetcode.cn/problems/intersection-of-two-linked-lists-lcci/description) 给定两个单链表的头节点headA和headB, 请找出并返回两个单链表相交的起始节点. 如果两个链表没有交点, 返回null. ......
20天 hot 100 速通计划-day12
### 回溯 #### [78. 子集](https://leetcode.cn/problems/subsets/) 给你一个整数数组 `nums` ,数组中的元素 **互不相同** 。返回该数组所有可能的子集(幂集)。 解集 **不能** 包含重复的子集。你可以按 **任意顺序** 返回解集。 ......
Leetcode 1388. 3n 块披萨
(本文只提供了解题思路的思考,[原文作者题解连接](https://leetcode.cn/problems/pizza-with-3n-slices/solutions/527304/dpjie-fa-yu-da-jia-jie-she-2-de-chai-bie-ihso/)) 先把题目粘贴在这 ......
leetcode1372dp求交错路径长
bfd+dp unordered_map<TreeNode* ,int>d,p; queue<pair<TreeNode* ,TreeNode*>>q; int dp(TreeNode* root){ d[root]=p[root]=0; q.push({root,nullptr}); while( ......
矩阵
# 一、矩阵的定义 对于 $m×n$ 个数的矩阵 $a_{i,j},i=[1,m],j=[1,n]$,有 $m$ 行 $n$ 列,称为 $m×n$ 矩阵,这个矩阵排列如下: $$\left[\begin{matrix} a_{1,1} & a_{1,2} & ⋯ & a_{1,n} \\ a_{2, ......
[LeetCode][70]climbing-stairs
# Content You are climbing a staircase. It takes n steps to reach the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can ......
[LeetCode][53]maximum-subarray
# Content Given an integer array nums, find the subarray with the largest sum, and return its sum. Example 1: Input: nums = [-2,1,-3,4,-1,2,1,-5,4] Ou ......
[LeetCode][55]jump-game
# Content You are given an integer array nums. You are initially positioned at the array's first index, and each element in the array represents your ......
[LeetCode][62]unique-paths
# Content There is a robot on an m x n grid. The robot is initially located at the top-left corner (i.e., grid[0][0]). The robot tries to move to the ......
[LeetCode][42]trapping-rain-water
# Content Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it can trap after raini ......
[LeetCode][10]regular-expression-matching
# Content Given an input string s and a pattern p, implement regular expression matching with support for '.' and '*' where: '.' Matches any single ch ......
[LeetCode][32]longest-valid-parentheses
# Content Given a string containing just the characters '(' and ')', return the length of the longest valid (well-formed) parentheses substring. Examp ......