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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:31:34+00:00 2026-05-27T05:31:34+00:00

You decided that you would give a shot at riding a unicycle while balancing

  • 0

You decided that you would give a shot at riding a unicycle while
balancing weights on both your hands. To make sure that you don’t
fall, you want the weights in your hands to balance out as much as
possible (i.e. the difference between the sum of the weights in either
of your hands must be as small as possible). Given the weights you
have, determine the smallest difference in weight between your left
and right hands.

Sample Input: 1 10 6

Sample Output: 3

Also, you don’t have to use all the weights, but you can’t use 0 weights. I’m thinking that a recursive function would be the best way to solve this.

By the way, this isn’t my homework or anything, it’s a question on a past Dwite contest.

  • 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-27T05:31:34+00:00Added an answer on May 27, 2026 at 5:31 am

    My PHP is a little rusty, but something like this should work:

    $left = 0; $right = 0;
    for_each($input as $value) {
      if ($left < $right) {
        $left += $value;
      } else {
        $right += $value;
      }
    }
    $answer = abs( $left - $right );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've decided to use this.variableName when referring to string/int etc.. fields. Would that include
I have a largish Mercurial repository that I've decided would be better as several
The thing is had a button that would do that but i decided it
I recently decided to give matplotlib.pyplot a try, while having used gnuplot for scientific
I have a class that contains decoded video frames. I would like my decoder
Ive decided that I really dont like microsoft and their ways. Please could you
I have decided that all my WPF pages need to register a routed event.
I've recently decided that I just have to finally learn C/C++, and there is
I have decided that I really need to get some flowcharts for reverse engineering
I have a class that had an inline member, but I later decided that

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.