Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to Divide Circular Array in C++ into K Group of Contiguous Elements

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 534
    Answer it

    How can I divide an circular array into k group of contiguous element such that difference between maximum sum and minimum sum is minimum. Each group have contiguous element of array.

    For e.g If the array is as follow.
    [6 13 10 2] and k=2 then o/p should be 18(6+10+2)-13=5. As array is circular 6,10,2 are contiguous element of array.

    For e.g If the array is as follow.
    [6 13 2 10] and k=2 then o/p should be 16(6+10)-15(13+2)=1. As array is circular 6,10 are contiguous element of array.

    For e.g If the array is as follow.
    [100 92 133 201 34 34 34 94 108] and k=4 then group as follow 208(108,100), 225(92,133), (201), 196(34,34,34,94) so 225-196=29

 0 Answer(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: