Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7568731
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T14:59:51+00:00 2026-05-30T14:59:51+00:00

Given a series x(i), i from 1 to N, let’s say N = 10,000.

  • 0

Given a series x(i), i from 1 to N, let’s say N = 10,000.

for any i < j,
D(i,j) = x(i) - x(j), if x(i) > x (j); or,
       = 0, if x(i) <= x(j).

Define

Dmax(im, jm) := max D(i,j), for all 1 <= i < j <=N.

What’s the best algorithm to calculate Dmax, im, and jm?

I tried to use Dynamic programming, but this seems is not dividable… Then i’m a bit lost… Could you guys please suggest? is backtracking the way out?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T14:59:52+00:00Added an answer on May 30, 2026 at 2:59 pm

    Iterate over the series, keeping track of the following values:

    • The maximum element so far
    • The maximum descent so far

    For each element, there are two possible values for the new maximum descent:

    • It remains the same
    • It equals maximumElementSoFar - newElement

    So pick the one which gives the higher value. The maximum descent at the end of iteration will be your result. This will work in linear time and constant additional space.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Another developer has given me an algorithm that returns a series of strings that
If I have a given series of numbers that count up by 1, say
Given a series of GPS coordinate pairs, I need to calculate the area of
I have a Lua function that, given n, generates all permutations of the series
Given any series of input dates with a single state of either Open or
I need to generate a series of N random binary variables with a given
given a Python class hierarchy, say class Base: def method1 def method2 def method3
Here's a question I've been racking my brain over. Let's say I have a
Summary: I'm given a series of points in 3D space, and I want to
I've retrieved a series of objects from the Twitter API, and I want to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.