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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T04:01:05+00:00 2026-05-29T04:01:05+00:00

An array of N elements is given indexed from 1 to N. All elements

  • 0

An array of N elements is given indexed from 1 to N. All elements are unknown and integers. Given some queries in the form of A, B, C where A is the starting index, B is the ending index and C is the sum of all elements between A and B inclusive. Find out all the elements of array. Example:

N=4
1, 3, 0
2, 4, 4

One valid solution to this is:

2, -3, 1, 6

Constraints:

1<=A<=B<=N, 2<=N<=65000, C<=1000000000

Any solution fulfilling the given criteria is accepted and assume enough queries are given to find out all the elements.

  • 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-29T04:01:05+00:00Added an answer on May 29, 2026 at 4:01 am

    One way to solve this is by treating the problem as a series of simultaneous equations. Each summation gives you a linear equation in up to n variables, so if you can find a solution to that equation that has integer values you should be all set.

    Using Gaussian Elimination on a series of n variables with k different constraints takes (assuming that n = O(k)) O(k3) time on expectation (assuming the system is well-conditioned). From there, finding integer solutions should be easy; just find the common denominator of any one solution vector and multiply through by it.

    Hope this helps!

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

Sidebar

Related Questions

Given an array. How can we find sum of elements in index interval (i,
zero-indexed array A consisting of N integers is given. A triplet (P, Q, R)
Given you have an array A[1..n] of size n, it contains elements from the
I'm trying to get an array of all elements with the class sampleclass. For
As stated in the docs for numpy.all() : numpy.all() tests whether all array elements
Consider the following problem. We are given an array of elements belonging to one
I got this problem from an interview with Microsoft. Given an array of random
Given an array of 81 elements (meant to represent a 9x9 grid) how can
Given an array of 2n elements of which n elements are same and the
We have an array A of integers of size N. Given another array B

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.