Question: Question 1 3 Max. score: 2 0 . 0 0 One block You are working in the resource distribution team of your company. A One

Question 13
Max. score: 20.00
One block
You are working in the resource distribution team of your company. A One
block is a block of data having exactly one resource which has value 1. You
are given an array Arr containing N resource values.
What is the number of ways to divide the array into continuous blocks such
that each block is One block.
NOTE - If we cannot form a block with One block, then output O.
Function description
Complete the function OneBlock(). This function takes the following 2
parameters and returns the required answer:
N : Represents the number of resources
Arr. Represents the value of resources
Input format for custom testing
Note: Use this input format if you are testing against custom input or writing
code in a language where we don't provide boilerplate code
The first line contains an integer N denoting the number of resources.
The second line contains N space-separated integers denoting the value
of resources.
Output format
Print the number of ways to divide the array into continuous blocks such that : Programming question
:' :
38min08sec
Explanation
Given
N=3
Arr =[0,1,0]
Approach
There is exactly one resource that has the value of 1. Hence, the number of ways is 1.
Note:
Your code must be able to print the sample output from the provided sample input.
However, your code is run against multiple hidden test cases. Therefore, your code must
pass these hidden test cases to solve the problem statement.
Limits
Time Limit: 1.0sec(s) for each input file
Memory Limit: 256MB
Source Limit: 1024 KB
Scoring
Score is assigned if any testcase passes
Allowed Languages
Bash, C, C +114, C ++17, Clojure, C#, D, Erlang, F#, Go, Groov & Haskell, Java 8, Java 14,
Java 17, JavaScript(Node.js), Julia, Kotlin, Lisp (SBCL), Lua, O FCtive-C, OCaml, Octave,
Pascal, Perl, PHP, Python, Python 3, Python 3.8, Racket, Ruby Bust, Scala, Swift,
TypeScript, Visual Basic Output formet
Print the number of ways to divide the array into continuous blocks such that
each block is One block.
Constraints
1N100
0Arr11
Sample input
Sample output
3
e 10
Explanation
Given
-N=3
- Arr=[0,1,0]
Approach
There is exactily one resource that has the value of 1 Hence. the number of ways is 1
 Question 13 Max. score: 20.00 One block You are working in

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!