Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Solve all 3 in java 1) Given an NxM matrix that contains only Os and 1s, find out the size of the maximum square sub-matrix

Solve all 3 in java image text in transcribed

1) Given an NxM matrix that contains only Os and 1s, find out the size of the maximum square sub-matrix with all Os. You need to return the size of the square matrix with all Os. Input format: The first line of the test case contains two integer values, 'N' and 'M', separated by a single space. They represent the 'rows' and 'columns' respectively. Second-line onwards, the next 'N' lines or rows represent the ith row values. Each of the ith rows constitutes column values separated by a single space (Either oor 1). Output Format: Print the size of maximum square sub-matrix. 2) Given two strings S and T with lengths M and N. Find and return the length of their shortest 'Super Sequence'. The shortest 'Super Sequence of two strings is defined as the smallest string possible that will have both the given strings as its subsequences. Note : If the two strings do not have any common characters, then return the sum of the lengths of the two strings. Input Format: The first only line of input contains a string, that denotes the value of string S. The following line contains a string, that denotes the value of string T. 3) You are given a magic grid A with R rows and C columns. In the cells of the grid, you will either get magic juice, which increases your strength by A[i][j] points, or poison, which takes away (A[i][j]l strength points. If at any point of the journey, the strength points become less than or equal to zero, then you will die. You have to start from the top-left corner cell (1,1) and reach at the bottom-right corner cell (R,C). From a cell (i,j), you can only move either one cell down or right i.e., to cell (i+1,j) or cell (i,j+1) and you can not move outside the magic grid. You have to find the minimum number of strength points with which you will be able to reach the destination cell

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_2

Step: 3

blur-text-image_3

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

DB2 Universal Database V7.1 Application Development Certification Guide

Authors: Steve Sanyal, David Martineau, Kevin Gashyna, Michael Kyprianou

1st Edition

0130913677, 978-0130913678

More Books

Students also viewed these Databases questions

Question

Draft a proposal for a risk assessment exercise.

Answered: 1 week ago