One Block COding question - Solved

12 Live
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 Nresource 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 0 Function description Complete the function OneBlock() This function takes the following 2 parameters and returns the required answer. . N: Represents the number of resources . Ar 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 Return the number of ways to divide the array into continuous blocks such that each block is One block. Constraints 1 < N ≀ 100 Sample input Sample output

Asked in: SHARECHAT

Image of the Question

Question Image Question Image Question Image

All Testcases Passed βœ”



Passcode Image

Solution


Please login to view the solution


Related Questions

| Given an n x m grid, where rows are numbered from 7 to n and columns from 1 to … |
| There are 'N' coders standing in a line, where i denotes the ith position of a … |
| A birthday party was attended by N number of kids, and each kid was given a uni… |
| Given a matrix of size m * n, where m denotes the number of rows (starting with… |
| A traveler is traveling from the city of Zeta to Omega. He starts with X amount… |
| As an operations engineer at Amazon, you are responsible for organizing the dis… |