## This problem has been solved!

Do you need an answer to a question different from the above? Ask your question!

# There are 2 shinobis with chakra levels 5 and 10 respectively and the desired sum of chakra levels is utmost 15 Starting with ke0, suy of chakra levels after attack max(5-0,0) + max(10- 0,0) 5+10 15. Therefore, 0 is the minimum value of k' which reduces the sum of chakra levels to utmost 15. Hence, 0 is returned as

**Transcribed Image Text:**

## There are 2 shinobis with chakra levels 5 and 10 respectively and the desired sum of chakra levels is utmost 15 Starting with ke0, suy of chakra levels after attack max(5-0,0) + max(10- 0,0) 5+10 15. Therefore, 0 is the minimum value of k' which reduces the sum of chakra levels to utmost 15. Hence, 0 is returned as the output. There are 2 shinobis with chakra levels 5 and 10 respectively and the desired sum of chakra levels is utmost 15 Starting with ke0, suy of chakra levels after attack max(5-0,0) + max(10- 0,0) 5+10 15. Therefore, 0 is the minimum value of k' which reduces the sum of chakra levels to utmost 15. Hence, 0 is returned as the output. Section 1 of 1 Hands-on PIv Explanation: There are 3 shinobis with chakra levels 1, 2 and 3 respective arthe desired sum of chakra levels is utmost 2, Sasuke wants toarfun an attack of minimum strength k, which will reduce the sum chakra levels to utmost 2. Starting with k=0: If k = 0, the sum of the chakra levels after attack = max(1-0,0) + max(2- 0,0) + max(3-0,0) = 1+2+3 = 6. If k= 1, the sum of the chakra levels after attack = max(1-1,0) + max(2- 1,0) + max(3-1,0) = 0+1+2 = 3. If k = 2, the sum of the chakra levels after attack = max(1-2,0) + max(2- 2,0) + max(3-2,0) = 0+0+1 = 1. Therefore, 2 is the minimum value of 'k' which reduces the sum of chakra levels to at most 2. Hance, 2 is returned as the output. Example 2: inputt: 2 input2: (5,10) input3: 15 Section 1 of 1 Hands-on PIv Explanation: There are 3 shinobis with chakra levels 1, 2 and 3 respective arthe desired sum of chakra levels is utmost 2, Sasuke wants toarfun an attack of minimum strength k, which will reduce the sum chakra levels to utmost 2. Starting with k=0: If k = 0, the sum of the chakra levels after attack = max(1-0,0) + max(2- 0,0) + max(3-0,0) = 1+2+3 = 6. If k= 1, the sum of the chakra levels after attack = max(1-1,0) + max(2- 1,0) + max(3-1,0) = 0+1+2 = 3. If k = 2, the sum of the chakra levels after attack = max(1-2,0) + max(2- 2,0) + max(3-2,0) = 0+0+1 = 1. Therefore, 2 is the minimum value of 'k' which reduces the sum of chakra levels to at most 2. Hance, 2 is returned as the output. Example 2: inputt: 2 input2: (5,10) input3: 15 Input Specification: inputt: An integer value N representing the number of shinobis eeN e= 1000) input2: An integer array, containing the chakra levels of N sh bis input3: An integer value S, the maximum sum of chakra lev attack where (0 <= S = 10) after the Output Specification: Return an integer value representing the minimum strength 'k' of the lightning blade attack that can achieve this task. Example 1: input1: 3 input2: (1,2.3) input3: 2 Input Specification: inputt: An integer value N representing the number of shinobis eeN e= 1000) input2: An integer array, containing the chakra levels of N sh bis input3: An integer value S, the maximum sum of chakra lev attack where (0 <= S = 10) after the Output Specification: Return an integer value representing the minimum strength 'k' of the lightning blade attack that can achieve this task. Example 1: input1: 3 input2: (1,2.3) input3: 2 Revisit Question # 1 How to attempt? Question: Sasuke's Attack Sasuke being one of the most powerful Ninjas in the world, is bg ed with 'N' number of shinobis. Each shinobi T (0 <=i< N) has " (1<=Ci<= 100000) chakras, With a single shot of a lightening blade of rength 'k', Sasuke can reduce the chakra level of each shinobi 'i' to a maximum of (Ci-k, 0). Sasuke now wants to reduce the sum of chakra level of all shinobi to utmost 'S'. You need to help Sasuke retun the minimum strength 'k' of a lightning blade attack that can achieve this task. Innut Snecification: Revisit Question # 1 How to attempt? Question: Sasuke's Attack Sasuke being one of the most powerful Ninjas in the world, is bg ed with 'N' number of shinobis. Each shinobi T (0 <=i< N) has " (1<=Ci<= 100000) chakras, With a single shot of a lightening blade of rength 'k', Sasuke can reduce the chakra level of each shinobi 'i' to a maximum of (Ci-k, 0). Sasuke now wants to reduce the sum of chakra level of all shinobi to utmost 'S'. You need to help Sasuke retun the minimum strength 'k' of a lightning blade attack that can achieve this task. Innut Snecification:

## Expert Answer

In the question algorithm and instructions …
View the full answer

**Related Book For**

## Understanding Basic Statistics

6th edition

Authors: Charles Henry Brase, Corrinne Pellillo Brase

ISBN: 978-1111827021

## Students also viewed these programming questions

- Q: An experiment to compare k = 3 factor levels has n1 =
- Q: Section 1 Section 2 Section 3 57 91 55 77 88 96
- Q: Qunitana Pena expects to receive a $500,000 cash benefit when she retires