Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You are at a shooting range. You have N target labeled from 1 to N from left to right. Your task is to shoot the

You are at a shooting range. You have N target labeled from 1 to N from left to right.
Your task is to shoot the target by performing the following operation.
In each round starting from the first element and moving from left to right, shoot every alternate target.
Repeat the above step until only one target is left.
By shooting a target labeled i you will get i points.
Task
Return the total number of points you will get by shooting targets until only one target is left.
Example
Assumption
N=7
Approach
Targets =[1,2,3,4,5,6,7]
Initial points =0
Targets =[1,2,3,4,5,6,7]. Targets to be removed are 1,3,5,7. Points =0+1+3+5+7=16.
Targets =[2,4,6]. Targets to be removed are 2,6. Points =16+2+6=24.
Targets =[4], only one target is left therefore return total points i.e.24.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Temporal Databases Research And Practice Lncs 1399

Authors: Opher Etzion ,Sushil Jajodia ,Suryanarayana Sripada

1st Edition

3540645195, 978-3540645191

Students also viewed these Databases questions

Question

8. Explain the difference between translation and interpretation.

Answered: 1 week ago

Question

10. Discuss the complexities of language policies.

Answered: 1 week ago

Question

1. Understand how verbal and nonverbal communication differ.

Answered: 1 week ago