首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏calmound

    Maximum Subarray

    问题:最大连续子窜和是多少 分析:动态规划,定义max记录最大值,sum记录以i结束的连续子窜的最大值 class Solution { public: int maxSubArray(int A[], int n) { int sum; int MAX=A[0]; sum=A[0]; for(int i=1;i<n;i++) { if(sum+A[i]<A[i]) sum=A[i];

    59380发布于 2018-04-17
  • 来自专栏mathor

    Maximum Flow

    本文参考以下文章 Maximum flow Flow Networks基本性质 在图论中,网络流被定义为一个有向图,其中包含一个起点Source和一个终点Target,以及几条连接各顶点的边。 以上图为例,寻找Maximum Flow的步骤如下 开始时用flow = 0初始化residual Networks ? 找到Maximum Flow=17 ? ][y] -= min_capacity; graphResidual[y][x] += min_capacity; } } cout << "Maximum

    1.1K20发布于 2020-03-06
  • 来自专栏SnailTyan

    Maximum Subarray

    本文主要是对最大子数组(序列)问题求解的学习与总结,最大子数组问题是一道经典的算法题,这道题解法有很多,因此可以学习到很多求解问题的思路,并可以学习到算法的优化过程。

    64910发布于 2019-05-25
  • 来自专栏CTF及算法学习

    1007 Maximum Subsequence Sum

    The Maximum Subsequence is the continuous subsequence which has the largest sum of its elements. For example, given sequence { -2, 11, -4, 13, -5, -2 }, its maximum subsequence is { 11, -4, 13 } with Now you are supposed to find the largest sum, together with the first and the last numbers of the maximum

    64520发布于 2020-03-12
  • 来自专栏给永远比拿愉快

    Leetcode: Maximum Subarray

    题目: Find the contiguous subarray within an array (containing at least one number) which has the largest sum.

    53120发布于 2019-01-22
  • 来自专栏luozhiyun的技术学习

    Third Maximum Number

    Given a non-empty array of integers, return the third maximum number in this array. Example 1: Input: [3, 2, 1] Output: 1 Explanation: The third maximum is 1. Example 2: Input: [1, 2] Output: 2 Explanation: The third maximum does not exist, so the maximum (2 maximum distinct number. Both numbers with value 2 are both considered as second maximum.

    45920发布于 2019-09-10
  • 来自专栏SnailTyan

    Maximum Product Subarray

    求解 这个题跟Leetcode 53——Maximum Subarray类似,可以用三重循环,两种循环解决。但最好的还是用动态规划解决,找出状态转移方程最关键。 与Maximum Subarray相比,最大值为maxValue = max(minValuePre * nums[i], maxValuePre * nums[i], nums[i]),最小值同样如此

    54920发布于 2019-05-25
  • 来自专栏以终为始

    Maximum GCD(UVA 11827)

    Problem:Given the N integers, you have to find the maximum GCD (greatest common divisor) of every possible Each test case contains M (1 < M < 100) positive integers that you have to find the maximum of GCD. Output :For each test case show the maximum GCD of every possible pair.

    44320编辑于 2023-03-09
  • 来自专栏Reck Zhang

    LeetCode 0164 - Maximum Gap

    Maximum Gap Desicription Given an unsorted array, find the maximum difference between the successive Explanation: The sorted form of the array is [1,3,6,9], either (3,6) or (6,9) has the maximum

    37720发布于 2021-08-11
  • 来自专栏计算机视觉与深度学习基础

    Leetcode 53 Maximum Subarray

    Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array [-2,1,-3,4,-1,2,1,-5,4], the contiguous subarray [4,-1,2,1] has the largest sum = 6. 求最大连续子串和,DP入门题,只有在之前的子情况和大于0的时候,才

    79060发布于 2018-01-12
  • 来自专栏搬砖记录

    50 Maximum Binary Tree

    A maximum tree building on this array is defined as follow: The root is the maximum number in the array The left subtree is the maximum tree constructed from left part subarray divided by the maximum number The right subtree is the maximum tree constructed from right part subarray divided by the maximum number Construct the maximum tree by the given array and output the root node of this tree.

    35320发布于 2021-08-18
  • 来自专栏皮皮星球

    Maximum Subarray

    Maximum Subarray Given an integer array nums, find the contiguous subarray (containing at least one number

    36410发布于 2020-09-23
  • 来自专栏搬砖记录

    07 Maximum 69 Number

    Return the maximum number you can get by changing at most one digit (6 becomes 9, and 9 becomes 6). The maximum number is 9969. Example 2: Input: num = 9996 Output: 9999 Explanation: Changing the last digit 6 to 9 results in the maximum 解答 class Solution { public int maximum69Number (int num) { String s = String.valueOf(num) 其他答案 public int maximum69Number(int num) { char[] chars = Integer.toString(num).toCharArray(); for

    38230发布于 2021-08-18
  • 来自专栏calmound

    Maximum Depth of Binary Tree

    问题:二叉树的最深深度 class Solution { public: void dfs(TreeNode *root,int step,int &MAX) { if(root==NULL) { if(MAX<step) MAX=step; return ; } dfs(root->left,step+1); dfs(root->right,step+1);

    50530发布于 2018-04-17
  • 来自专栏尾尾部落

    Maximum Depth of Binary Tree

    Maximum Depth of Binary Tree Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthest

    51540发布于 2018-09-04
  • 来自专栏一点ECON

    Maximum Likelihood Estimation in STATA

    在这些模型之外,STATA同时提供了ML syntax来拓展可以估计maximum likelihood模型。下面我们举例子说明ML syntax的用法。

    1.7K21发布于 2019-07-04
  • 来自专栏SnailTyan

    Maximum Width of Binary Tree

    1. Description 2. Solution /** * Definition for a binary tree node. * struct TreeNode { * int

    1.1K20发布于 2019-05-25
  • 来自专栏给永远比拿愉快

    Leetcode: Maximum Product Subarray

    思路:这道题和上一道题:Maximum Subarray思路差不多。Maximum Subarray是求子数组和的最大值,这道题是求子数组乘积的最大值。

    47510发布于 2019-01-22
  • 来自专栏Reck Zhang

    LeetCode 0053 - Maximum Subarray

    Maximum Subarray Desicription Find the contiguous subarray within an array (containing at least one number

    32510发布于 2021-08-11
  • 来自专栏来自地球男人的部落格

    Maximum Product Subarray

    本文讨论了最大产品子数组的问题,该问题在LeetCode上频繁出现。文章首先介绍了问题,然后解释了如何通过记录负数出现次数的方法来解决该问题。接着,文章使用一个示例数组,展示了如何正确实现该算法。最后,文章返回了示例的最大产品子数组。

    99450发布于 2018-01-03
领券