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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:28:37+00:00 2026-05-25T20:28:37+00:00

Faced this question in my interview. What I answerred is that: divide 1b numbers

  • 0

Faced this question in my interview.

What I answerred is that:

  1. divide 1b numbers into 10 group

  2. Use threadpool to create one thread for each group, 10 totally

  3. each thread sum up the result for the group passed and retrun the value

  4. use Barrier to sum up all results after 10 threads end, return the final value

My doubt is what’s the expected answer for this question ?
And if it’s running in single-cpu (no multi-thread mode), should single thread be faster than multi-thread ?

Thanks a lot.

  • 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-25T20:28:38+00:00Added an answer on May 25, 2026 at 8:28 pm

    A trick question, perhaps – to see if you can think outside the box you’re given?

    If they’re consecutive, as noted in the title, and they begin with n, then:

    final long BILLION = 1000000000;
    long answer = (BILLION * n) + ( BILLION*BILLION + BILLION ) / 2;
    

    This works for n up to somewhere around a billion – after that it will overflow.

    Needless to say, I don’t see how multithreading would be of any benefit at all!

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

Sidebar

Related Questions

This is also one of the interview question i have faced recently. Description :
I was faced this question while one of recent interview : class1 { virtual
This is an interview question I faced recently. Given an array of 1 and
I have faced this question in my Interview as well. I do have many
Today I faced one question in interview. Is it possible to apply inheritance concept
I faced this question in interview. When I searched on internet I found different
One of my friends faced this in his recent interview. I'm posting 2 questions
I have faced the following interview question. Consider this function declaration: void quiz(int i)
In an pre-interview, I am faced with a question like this: Given a string
For this question, let us assume that we will want to show the face

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.