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 8616345
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:35:49+00:00 2026-06-12T05:35:49+00:00

Consider there are k-lists with numbers in an increasing order. Select one number from

  • 0

Consider there are k-lists with numbers in an increasing order. Select one number from each list such that the difference between the highest number and lowest number in the output list is minimum:

list 1-1,3,5,9,10
list 2-2,4,6,8
list 3-7,11,12,13

The output should be 5,6,7.

5 is selected from list-l and 6 from list-2 and 7 from list-3

As the difference between highest and lowest number in that list is 2 that is 7-5 consider there are k-lists.

  • 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-12T05:35:50+00:00Added an answer on June 12, 2026 at 5:35 am

    i can solve this in O(N*LogK), here N is the total number of numbers in the k lists.

    1, maintain a pointer for each list, starting from 0.

    2, regard current pointers as the numbers you choose, update the answer.

    3, select the one with minimum number and increase it by one(as long as it didn’t reach the end of that list), if possible, back to step 2, otherwise terminate.

    in step 2, and step 3, use heap to maintain the minimum number and maximum, which reduce the time from O(K) to O(LogK).

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

Sidebar

Related Questions

Is there a list of such characters on the web? For example, vb.net consider
Consider there are three array list each of equal length and having positive, negative
Consider that there is a bunch of tables which link to countries or currencies
Consider this problem: There's a square grid defined, each tile being either passable (1)
Are there some standards that you consider to be so obvious that they would
EDIT: This isn't as trivial as you think. Consider the fact that each addition
In Mathematica there are a number of functions that return not only the final
Consider the following scenario:- A bookstore website has number of books and each book
Consider the following C# code: IEnumerable numbers = Enumerable.Range(0, 10); var evens = from
I have a number of functions that parse data from files, usually returning a

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.