拓扑 前缀 线性leetcode

leetcode_打卡5

leetcode_打卡5 题目:345. 反转字符串中的元音字母 思路:双指针 class Solution { public String reverseVowels(String s) { int n=s.length(); char[] arr=s.toCharArray(); int i=0 ......
leetcode

LeetCode-Top100:两数之和(python)

给定一个整数数组 nums 和一个整数目标值 target,请你在该数组中找出 和为目标值 target 的那 两个 整数,并返回它们的数组下标。 你可以假设每种输入只会对应一个答案。但是,数组中同一个元素在答案里不能重复出现。 你可以按任意顺序返回答案。 示例 1: 输入:nums = [2,7, ......
之和 LeetCode-Top LeetCode python 100

扎实打牢数据结构算法根基,从此不怕算法面试系列之004 week01 02-04 使用泛型实现线性查找法

1、算法描述 在数组中逐个查找元素,即遍历。 2、上一篇文的实现结果 在 扎实打牢数据结构算法根基,从此不怕算法面试系列之003 week01 02-03 代码实现线性查找法中,我们实现了如下代码: package com.mosesmin.datastructure.week01.chap02; ......
算法 数据结构 根基 线性 结构

扎实打牢数据结构算法根基,从此不怕算法面试系列之002 week01 02-02 线性查找法

1、线性查找法 什么是线性查找法? 举例:在一沓试卷中,找到属于自己的那张试卷。 第1张:不是 第2张:不是 第3张:不是 …… 第n张:是,找到了! 第n+1张:不找了 …… 这个解决问题的思路和过程体现就是线性查找法的思想。 #2、线性查找法思路梳理 线性查找法,就是在线性的数据结构中来完成。 ......
算法 数据结构 根基 线性 结构

扎实打牢数据结构算法根基,从此不怕算法面试系列之003 week01 02-03 代码实现线性查找法

1、算法描述 在数组中逐个查找元素,即遍历。 2、思路原理 如算法描述,基本是最简单的代码块了,没有什么额外的原理。 3、初步的代码实现 线性查找法初步的代码实现: package com.mosesmin.datastructure.week01.chap02; /** * @Misson&Goa ......
算法 数据结构 根基 线性 结构

LeetCode 双周赛 102,模拟 / BFS / Dijkstra / Floyd

本文已收录到 AndroidFamily,技术和职场问题,请关注公众号 [彭旭锐] 提问。 大家好,欢迎来到小彭的 LeetCode 周赛解题报告。 昨晚是 LeetCode 双周赛第 102 场,你参加了吗?这场比赛比较简单,拼的是板子手速,继上周掉大分后算是回了一口血 😁。 2618. 查询网 ......
LeetCode Dijkstra Floyd 102 BFS

3.线性神经网络

回归(regression)是能为一个或多个自变量与因变量之间关系建模的一类方法。 在自然科学和社会科学领域,回归经常用来表示输入和输出之间的关系。 ......
神经网络 线性 神经 网络

【前缀和】LeetCode 523. 连续的子数组和

题目链接 523. 连续的子数组和 思路 参考宫水三叶大佬题解 一开始以为和 Leetcode 53 Maximum Subarray 思路差不多,都是求子数组的值。但是后来发现在53题中并没有求出每个子数组的和,只是在贪心的情况下求出了可能的最大和 代码 class Solution { publ ......
前缀 数组 LeetCode 523

[LeetCode] 1042. Flower Planting With No Adjacent

You have n gardens, labeled from 1 to n, and an array paths where paths[i] = [xi, yi] describes a bidirectional path between garden xi to garden yi. I ......
LeetCode Adjacent Planting Flower 1042

svd,BD,ZF,SLNR,MMSE线性预编码性能对比MATLAB仿真

1.算法仿真效果 matlab2022a仿真结果如下: 2.算法涉及理论知识概要 线性预测编码(LPC)是主要用于音频信号处理与语音处理中根据线性预测模型的信息用压缩形式表示数字语音信号谱包络(en:spectral envelope)的工具。它是最有效的语音分析技术之一,也是低位速下编码方法高质量 ......
线性 编码 性能 MATLAB SLNR

线性规划相关题解集

P6631 [ZJOI2020] 序列 题解 注意到原题是个整数规划,记所有操作的集合为 $\mathcal{I}$,操作 $i$ 的次数为 $x_i$ 化成标准型如下: $$ \begin{align*} &\max\sum_{i\in\mathcal{I}}x_i\ s.t.\ & \sum_{ ......
题解 线性

LeetCode 115. 不同的子序列

class Solution { public: long long f[1010][1010];//f[i][j]表示s前i个字符得到t前j个字符的所有方案 int numDistinct(string s, string t) { f[0][0]=1; int n=s.size(),m=t.si ......
序列 LeetCode 115

线性DP

线性DP 最长公共子序列 O(n*m)写法 int a[MAXN], b[MAXM], f[MAXN][MAXM]; int dp() { for (int i = 1; i <= n; i++) for (int j = 1; j <= m; j++) if (a[i] == b[j]) f[i] ......
线性

LeetCode/最大化城市的最小供电站数目

政府批准了可以额外建造 k 座供电站,你需要决定这些供电站分别应该建在哪里,这些供电站与已经存在的供电站有相同的供电范围。 给你两个整数 r 和 k ,如果以最优策略建造额外的发电站,返回所有城市中,最小供电站数目的最大值是多少。 ###一. 二分法+前缀和+贪心 分析:最大化最小值,首先考虑使用二 ......
供电站 数目 LeetCode 城市

leetcode-1337-easy

The K Weakest Rows in a Matrix You are given an m x n binary matrix mat of 1's (representing soldiers) and 0's (representing civilians). The soldiers ......
leetcode 1337 easy

leetcode-1342-easy

Number of Steps to Reduce a Number to Zero Given an integer num, return the number of steps to reduce it to zero. In one step, if the current number i ......
leetcode 1342 easy

leetcode-1360-easy

Number of Days Between Two Dates Write a program to count the number of days between two dates. The two dates are given as strings, their format is YY ......
leetcode 1360 easy

leetcode-766-easy

Toeplitz Matrix Given an m x n matrix, return true if the matrix is Toeplitz. Otherwise, return false. A matrix is Toeplitz if every diagonal from top ......
leetcode easy 766

leetcode-806-easy

Number of Lines To Write String You are given a string s of lowercase English letters and an array widths denoting how many pixels wide each lowercase ......
leetcode easy 806

leetcode-812-easy

Largest Triangle Area Given an array of points on the X-Y plane points where points[i] = [xi, yi], return the area of the largest triangle that can be ......
leetcode easy 812

leetcode-830-easy

Positions of Large Groups In a string s of lowercase letters, these letters form consecutive groups of the same character. For example, a string like ......
leetcode easy 830

leetcode-844-easy

Backspace String Compare Given two strings s and t, return true if they are equal when both are typed into empty text editors. '#' means a backspace c ......
leetcode easy 844

leetcode-944-easy

Delete Columns To Make Sorted You are given an array of n strings strs, all of the same length. The strings can be arranged such that there is one on ......
leetcode easy 944

代码随想录算法训练营Day01 | LeetCode704 二分查找、Leetcode27 移除元素

今日学习的视频和文章 代码随想录数组基础 复习基础知识 代码随想录 二分查找 代码随想录 移除元素 LeetCode704 二分查找 题目链接:704. 二分查找 - 力扣(Leetcode) 以前学二分查找的时候,真的一直搞不清楚怎么操作左边界和有边界,以及循环的终止条件是什么,总是自己慢慢调试出 ......
随想录 训练营 随想 算法 LeetCode

leetcode_打卡04

leetcode_打卡04 题目:605. 种花问题 解答: 三种情况: 第一个1的左边全是0的情况,此时 可以插入的位置为result=(i-1+1)/2 ,如【0,0,0,1,0,0,1】 两个1之间全是0的情况。此时 可以插入的位置为result=(i-flag-1-2+1)/2 第一个1的右 ......
leetcode

用R语言用Nelson Siegel和线性插值模型对债券价格和收益率建模|附代码数据

原文链接:http://tecdat.cn/?p=11758 最近我们被客户要求撰写关于Nelson Siegel和线性插值模型的研究报告,包括一些图形和统计输出。 保证金购买是指投资者先从银行或经纪人处借得资金购买证券,而所购买的证券作为借入资金的抵押 债券基础 零息债券是指以贴现方式发行,不附息 ......
收益率 线性 债券 收益 模型

LeetCode 周赛 340,质数 / 前缀和 / 极大化最小值 / 最短路 / 平衡二叉树

本文已收录到 AndroidFamily,技术和职场问题,请关注公众号 [彭旭锐] 提问。 大家好,我是小彭。 上周跟大家讲到小彭文章风格的问题,和一些朋友聊过以后,至少在算法题解方面确定了小彭的风格。虽然竞赛算法题的文章受众非常小,但却有很多像我一样的初学者,他们有兴趣参加但容易被题目难度和大神选 ......
质数 前缀 LeetCode 340

LeetCode习题——有效的完全平方数(二分查找)

有效的完全平方数 力扣链接:367. 有效的完全平方数 题目 给你一个正整数 num 。如果 num 是一个完全平方数,则返回 true ,否则返回 false 。 完全平方数是一个可以写成某个整数的平方的整数。换句话说,它可以写成某个整数和自身的乘积。 不能使用任何内置的库函数,如 sqrt 。 ......
习题 LeetCode

[LeetCode] 1440. Jump Game V 跳跃游戏之五

Given an array of integers arr and an integer d. In one step you can jump from index i to index: i + x where: i + x < arr.length and 0 < x <= d. i - x ......
LeetCode 1440 Jump Game

带有PV面板和电池的孤岛微电网的混合整数线性规划(MILP)调度

带有PV面板和电池的孤岛微电网的混合整数线性规划(MILP)调度 测试环境:MATLAB,YALMIP,GUROBI 将负荷和太阳辐射预测作为输入。 返回计划范围内(例如一周)的每个组件的计划。 试图最大程度地减少甩负荷和减少发电量。ID:14100644860196918 ......
整数 孤岛 电网 线性 面板