ICode9

精准搜索请尝试: 精确搜索
  • 最大子数组 && 最大子矩阵2022-07-09 22:31:56

          https://leetcode.cn/problems/maximum-subarray/   func maxSubArray(nums []int) int { maxAns:=-99999999999 len:=len(nums) ans:=0;begin:=0 le:=0;ri:=len-1 for i:=0;i<len;i++{ ans=ans+nums[i] if ans>=maxAns{

  • leetcode867.转置矩阵(小学生难度)2022-07-09 09:35:28

    给你一个二维整数数组 matrix, 返回 matrix 的 转置矩阵 。 矩阵的 转置 是指将矩阵的主对角线翻转,交换矩阵的行索引与列索引。     示例 1: 输入:matrix = [[1,2,3],[4,5,6],[7,8,9]]输出:[[1,4,7],[2,5,8],[3,6,9]]示例 2: 输入:matrix = [[1,2,3],[4,5,6]]输出:[[1,4],[2,

  • [dp 记录] abc258Ex Odd Steps2022-07-08 08:32:26

    题意转化:给定 \(n\) 个整数和 \(S\),选一个从小到大排序的数列,\(0\) 和 \(S\) 必选,使相邻两数奇偶性不同,给出的 \(n\) 个数不能选。求方案数。 \(S \leq 10^{18},n \leq 10^5\) 看着非常 \(dp\),但是 \(S\) 极大,于是就是矩乘优化 \(dp\) 了。 令 \(dp_i\) 表示所选数均 \(\leq i\)

  • 图论 Graph Theory2022-07-06 23:31:07

    Graph Theory 图论 Laplacian matrix Categories of graphs: directed/undirected. homogeneous/heterogeneous. static/dynamic. A dynamic graph is a graph whose topology varies with time. It is a matrix representation of a graph. It can be used: (1) to construct

  • java算法:二维数组中的查找2022-07-06 18:31:16

    问题 在一个 n * m 的二维数组中,每一行都按照从左到右递增的顺序排序,每一列都按照从上到下递增的顺序排序。请完成一个高效的函数,输入这样的一个二维数组和一个整数, 判断数组中是否含有该整数。 解决 //1、线性查找 class Solution { public boolean findNumberIn2DArray(in

  • Eigen 矩阵基本运算2022-07-06 15:32:10

    矩阵和向量的运算 提供一些概述和细节:关于矩阵、向量以及标量的运算。 1. 介绍 Eigen提供了matrix/vector的运算操作,既包括重载了c++的算术运算符+/-/*,也引入了一些特殊的运算比如点乘dot、叉乘cross等。 对于Matrix类(matrix和vectors)这些操作只支持线性代数运算,比如:ma

  • [NOI2013]矩阵游戏2022-07-05 19:01:32

    做题时间:2022.7.4 \(【题目描述】\) 给定正整数 \(a,b,c,d(a,b,c,d\leq 10^9)\) ,有一个 \(n\) 行 \(m\) 列( \(1\leq n,m\leq 10^{1000000}\) )的矩阵 \(F\) ,满足: \[F_{1,1}=1 \]\[F_{i,j}=a\cdot F_{i,j-1}+b(j\neq 1) \]\[F_{i,1}=c\cdot F_{i-1,m}+d(i\neq 1) \]求 \(F

  • 算法竞赛进阶指南0x35高斯消元与线性空间2022-07-04 20:04:21

    高斯消元 目录高斯消元ACWing207. 球形空间产生器(点击访问)求解思路代码ACWing208. 开关问题(点击访问)思路代码总结欣赏线性空间定义 ACWing209. 装备购买代码总结:AcWing210. 异或运算思路:注意线性空间的推广!DEBUG总结 高斯消元对应的矩阵有两种: 常规的线性方程组 异或操作(不需

  • 记录一下github actions 工作流2022-07-02 20:33:33

    Github示例 官方以及第三方提供的actions github actions说明 github官方说明 适用php的示例 swoole test.yml 借用 hyperf/component-creator 点击查看代码 name: PHPUnit on: [ push, pull_request ] env: SWOOLE_VERSION: '4.8.10' SWOW_VERSION: 'develop' jo

  • 搜索二维数组2022-06-30 20:15:28

       https://leetcode.cn/problems/er-wei-shu-zu-zhong-de-cha-zhao-lcof/   func findNumberIn2DArray(matrix [][]int, target int) bool { return find2(matrix,target) } //分别用两个指针,按照行和列的维度,从左下角开始线性搜索 //时间复杂度为O(n+m),空间复杂度为O(

  • 迪杰斯特拉算法-最短路径2022-06-27 21:32:40

    1.背景 2.代码 package com.ldp.algorithm.demo06Dijkstra; import java.util.Arrays; /** * @create 06/17 6:41 * @description <p> * 迪杰斯特拉算法-最短路径 * </p> */ public class Test01 { public static void main(String[] args) { char[] vertex

  • 密度峰值聚类算法的实现2022-06-27 20:00:25

    ​ 密度峰值聚类(Density peaks clustering, DPC)来自Science上Clustering by fast search and find of density peaks. 2014.数据挖掘课大作业中读到了它。再整理自大作业的研究实验报告,分享到博客。 ​ 分为三个部分,先是基本原理,然后写代码实现,然后是浅浅写一些问题和优化。 基

  • 最大路径和问题(摘樱桃问题)2022-06-27 11:00:27

    最大路径和问题(摘樱桃问题) 作者:Grey 原文地址: 最大路径和问题(摘樱桃问题) 题目链接 LeetCode 741. 摘樱桃 主要思路 本题的难点在于尝试,如何模拟一来一回的情况,我们可以这样做,定义两个小人,两个人都从(0,0)位置出发,到右下角位置,每人同时选择不同的下一步,如果两个小人跳到了同一个位

  • matrix.h2022-06-24 18:33:37

    /** * * * * * * * */ #ifndef __IGS__matrix_H #define __IGS__matrix_H #include <iterator> #include <iostream> namespace IGS { namespace detail { namespace ns_matrix { template<typena

  • 算法刷题12022-06-21 19:01:18

    题目一 给定两个非负数组x和hp,长度都是N,再给定一个正数rangex有序,x[i]表示i号怪兽在x轴上的位置;hp[i]表示i号怪兽的血量 range表示法师如果站在x位置,用AOE技能打到的范围是:[x-range,x+range],被打到的每只怪兽损失1点血量返回要把所有怪兽血量清空,至少需要释放多少次AOE技能? 题目

  • leetcode 221. Maximal Square 最大正方形(中等)2022-06-20 22:32:35

    一、题目大意 标签: 动态规划 https://leetcode.cn/problems/maximal-square 在一个由 '0' 和 '1' 组成的二维矩阵内,找到只包含 '1' 的最大正方形,并返回其面积。 示例 1: 输入:matrix = [["1","0","1","0","0"],["1","0&

  • elasticsearch安装2022-06-19 03:00:07

    jdk兼容:https://www.elastic.co/cn/support/matrix#matrix_jvm 操作系统兼容:https://www.elastic.co/cn/support/matrix#matrix_os 自身兼容:https://www.elastic.co/cn/support/matrix#matrix_compatibility 下载地址:https://artifacts.elastic.co/downloads/elasticsearch/elasti

  • 螺旋遍历和生成矩阵2022-06-17 10:35:18

    class Matrix: @staticmethod def spiral_matrix(matrix: list) -> list: """ 顺时针螺旋遍历矩阵 :param matrix: 矩阵,二维列表 :return: 遍历结果,一维列表 """ if not matrix: return

  • 14.矩阵置零2022-06-17 08:00:35

    73. 矩阵置零 给定一个 m x n 的矩阵,如果一个元素为 0 ,则将其所在行和列的所有元素都设为 0 。请使用 原地 算法。   示例 1: 输入:matrix = [[1,1,1],[1,0,1],[1,1,1]] 输出:[[1,0,1],[0,0,0],[1,0,1]] 示例 2: 输入:matrix = [[0,1,2,0],[3,4,5,2],[1,3,1,5]] 输出:[[0,0,0,0]

  • 反转、旋转与翻转2022-06-16 18:04:03

    非原地:一维用切片,二维用list(map(list, zip(*matrix)))格式 原地:一维反转 - 前后交换,二维旋转 - 对角线翻转交换之后再进行一维反转 python中字符串不可变,无法原地 class ReverseInSitu: """ 反转/旋转 """ # 反转字符串(python字符串不可变,故不能原地反转)

  • 电信客户流失预测挑战赛baseline分析2022-06-15 00:31:45

    1、使用了五折 kf = KFold(n_splits=folds, shuffle=True, random_state=seed) 2、lgbm的结果最好,训练速度相比于xgb和cat也比较快 train_matrix = clf.Dataset(trn_x, label=trn_y) valid_matrix = clf.Dataset(val_x, label=val_y) params = {

  • 每周总结之第四周2022-06-14 21:35:39

    这一周,建民哥给我们讲述了怎么使得代码可以变得简洁,方便阅读, 我还对上周进行的测试进行了第二阶段成功测试, package qiuhe;public class qiuhe { public static void main(String args[]) {          // TODO Auto-generated method stub        

  • [leetcode] 59. Spiral Matrix II2022-06-14 20:03:53

    题目 Given a positive integer n, generate an n x n matrix filled with elements from 1 to n2 in spiral order. Example 1: Input: n = 3 Output: [[1,2,3],[8,9,4],[7,6,5]] Example 2: Input: n = 1 Output: [[1]] Constraints: 1 <= n <= 20 思路 初始化矩阵,随后遍历

  • [leetcode] 240. Search a 2D Matrix II2022-06-14 20:00:48

    题目 Write an efficient algorithm that searches for a value target in an m x n integer matrix matrix. This matrix has the following properties: Integers in each row are sorted in ascending from left to right. Integers in each column are sorted in ascending

  • [游记]教练扒下来的Codeforces Round 798 Div2-2022.6.142022-06-14 19:03:43

    昨天听说今天是欢乐赛 然后就欢乐地IOI被血虐…… A.Lex String B.Mystic Permutation C.Infected Tree D.Lena and Matrix E.ANDfinity 然后就没有然后了 赛时得分: $500/500$  

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有