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

  • Home
  • SEARCH
  • 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 7816653
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T05:56:38+00:00 2026-06-02T05:56:38+00:00

Given a sequence of number which can be positive and negative, there are several

  • 0

Given a sequence of number which can be positive and negative, there are several algorithms to find the longest increasing subsequence. But can someone give me an algorithm to find the longest increasing subsequence with the maximum sum if there are multiple longest increasing subsequences?

Example: For 20, 1, 4, 3, 10, the answer is 1, 4, 10, not 1, 3, 10

  • 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-06-02T05:56:39+00:00Added an answer on June 2, 2026 at 5:56 am
    dpLen[i] = maximum length of a LIS with maximum sum ending at i
    dpSum[i] = maximum sum of a LIS with maximum sum ending at i
    
    for i = 0 to n do
      dpLen[i] = 1
      dpSum[i] = input[i]
    
      maxLen = 0
      for j = 0 to i do
        if dpLen[j] > maxLen and input[j] < input[i]
          maxLen = dpLen[j]
    
      for j = 0 to i do
        if dpLen[j] == maxLen and input[j] < input[i] and dpSum[j] + input[i] > dpSum[i]
          dpSum[i] = dpSum[j] + input[i]
    
      dpLen[i] = maxLen + 1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given an input sequence, what is the best way to find the longest (not
Given a package, how can I automatically find all its sub-packages?
Given any two sequences/vectors of M real numbers, I can easily compute their closeness
Given a sequence of data (it may have duplicates), a fixed-sized moving window, move
I would like to know if anyone sees a pattern in the sequence given
Given the following sequence: normal %(b)BOLD% normal I want to transform this into the
Given a unsorted sequence of a[1,...,n] of integers, give an O(nlogn) runtime algorithm to
Given the following model, I want to index the fields (sequence,stock) class QuoteModel(models.Model): quotedate
I'm looking for an algorithm that given two permutations of a sequence (e.g. [2,
I have a multithreaded process which inserts several records into a single table. The

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.