Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Collect Resources Flag Question Problem Description There is a rectangular field with two types of resources viz, resource A and resource B. At each cell

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Collect Resources Flag Question Problem Description There is a rectangular field with two types of resources viz, resource A and resource B. At each cell in the field, both of the resources can be present. There are two types of factories which can collect resource A and B. If resource A is collected in a factory then resource B is lost and vice versa. Now, these two factories are located perpendicular to each other i.e the factory collecting resource A is at the top (north) of the rectangular field and the factory collecting resource B is to the left (West) of the rectangular field. The resources have to be brought to the factory on a straight path without taking any turns. This implies that if there is any south-north conveyor belt in the cell, but the cell north of it contains an east-west conveyor belt, then all resources transported on the south-north conveyor belt will be lost. You have to design a conveyor belt system that maximizes the total amount of minerals mined, ie the sum of the amount of resource A transported to the top and the sum of the amount of resource B transported to the left. You are given a 2-D matrix A and B of the same size denoting the amount of resource of the corresponding type in that cell. Since the answer can be large, return it modulo 10 +7. Problem Constraints 1 Q1 > Q3 > S1 24 25 26 Default Section Bit Queries! A Flag Question Problem Description Given an integer array A containing N integers. In one operation we can select any one element from the array A and increment it by 1. You need to answer queries in each query you are given two integer Land R you need to tell the minimum number of operation you need to perform such that the subarray of A starting from index L and ending at index R contains at least one pair of elements whose bitwise AND is strictly greater than zero. NOTE: Each query is independent ie for each query consider the given array A to answer it. Problem Constraints 2 = 2 Input Format First argument is an integer array A of size N. Second argument is a 2D integer array B of size Q x 2 where (B[i][0], B[i][1]) denotes the L, R for ith query. Activate Windows Go to Settings to activate Windows. Output Format Return an integer array of size o denoting the answer to each queries. NOTE: Problem Description Alice and Bob were buying some chocolates. It was Alice's turn today to buy Bob chocolates. Bob gives Alice a list A of N chocolates where A[i] denotes price of ith chocolate. Alice being on a tight budget asks Bob if he can remove a few chocolates. Bob allows him to remove some chocolates whose price is X(which Alice can decide). Please find the minimum amount Alice has to pay today. Problem Constraints 1 Q1 > Q3 > S1 24 25 26 Default Section Bit Queries! A Flag Question Problem Description Given an integer array A containing N integers. In one operation we can select any one element from the array A and increment it by 1. You need to answer queries in each query you are given two integer Land R you need to tell the minimum number of operation you need to perform such that the subarray of A starting from index L and ending at index R contains at least one pair of elements whose bitwise AND is strictly greater than zero. NOTE: Each query is independent ie for each query consider the given array A to answer it. Problem Constraints 2 = 2 Input Format First argument is an integer array A of size N. Second argument is a 2D integer array B of size Q x 2 where (B[i][0], B[i][1]) denotes the L, R for ith query. Activate Windows Go to Settings to activate Windows. Output Format Return an integer array of size o denoting the answer to each queries. NOTE: Problem Description Alice and Bob were buying some chocolates. It was Alice's turn today to buy Bob chocolates. Bob gives Alice a list A of N chocolates where A[i] denotes price of ith chocolate. Alice being on a tight budget asks Bob if he can remove a few chocolates. Bob allows him to remove some chocolates whose price is X(which Alice can decide). Please find the minimum amount Alice has to pay today. Problem Constraints 1

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

Master The Art Of Data Storytelling With Visualizations

Authors: Alexander N Donovan

1st Edition

B0CNMD9QRD, 979-8867864248

More Books

Students also viewed these Databases questions

Question

Which VPN protocols for remote access are available?

Answered: 1 week ago

Question

using signal flow graph

Answered: 1 week ago

Question

How did you feel about taking piano lessons as a child? (general)

Answered: 1 week ago