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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T22:37:42+00:00 2026-06-17T22:37:42+00:00

Description: Given an array consists of n positive integers, find the largest C which

  • 0

Description:

Given an array consists of n positive integers, find the largest C which makes C=A+B. A,B,C are all in the given array.

Example:

1 1 1 4 5 5 6 6 10 9 C=10

1 3 6 C=-1, This means the largest C does not exist

I’m looking for an algorithm which is less than O(n^3), Can anyone give me some directions?

  • 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-17T22:37:43+00:00Added an answer on June 17, 2026 at 10:37 pm

    Sort the list. Iterate over C from largest to smallest, and over B from smallest to the value of C. So far, it’s O(n^2). For each (C, B) pair, calculate A, and you just need to find if it’s in the array. You can use a binary search for an overall time of O(n^2 log n).

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

Sidebar

Related Questions

I understand what tapply() does in R. However, I cannot parse this description of
this piece of code was given in a book. $query=select name, description from widget
Technology Used:- Asp.Net 2.0 Code:- See Below Description:- hello code given below is working
Here is the description of the the problem Given an integer N, write a
Given the following XML structure: <courses> <course> <title>foo</title> <description>bar</description> </course> ... </courses> How could
I have an array with a series of event IDs organized like this: $event['year']['month']['day']
I have given up tryng to figure out the reason of this issue, but
My question is related to this stackoverflow post: enter link description here , in
According to jQuery documentation ID Selector Description: Selects a single element with the given
This i'm sure is a simple overlook, but its given me quite a headache

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.