subash pothini
java array Two cells is a matrix will be called connected if they are adjacent on either x-axis or y-axis
0 Answer(s)      4 years and 11 months ago
Posted in : Java Interview Questions

Two cells is a matrix will be called connected if they are adjacent on either x-axis or y-axis (but not diagonally) For. eg., a[0,0] will be connected to both cells a[0,1] and a[1,0]. But it will not connected to cell a[1,1]

For this problem, lets say, cells denoted by integer <= 0 represent Water and cells denoted by non-zero positive integer represent Land. An Island is a connected land cells. Weight of an island is the sum of all integers in that island.

1 0 0 0 1 0 1 2 2 1 0 2 0 0 0 1

In above example matrix, there are two islands { a[0,0], a[0,1], a[0,2], a[1,2] } with weight of 5 units { a[2,1], a[3,1], a[3,2], a[3,3] }, with weight of 6 units

heaviest island is { a[2,1], a[3,1], a[3,2], a[3,3] } elements with weight 6

Problem: Implement Java code which takes 2 dimensional integer array as input and prints out heaviest island.

Related Tutorials/Questions & Answers:
x-axis and y-axis
x-axis and y-axis  hi,, i want to to write a program that display a graph of x-axis and y-xais when i entered the parameters of the function
java array
java array Two cells is a matrix will be called connected if they are adjacent on either x-axis or y-axis  Two cells is a matrix will be called connected if they are adjacent on either x-axis or y-axis (but not diagonally
Dividing of two Matrix in Java
;Here you will learn how to use two matrix array for developing Java program.  The java two dimensional array program is operate the two matrix. Now we... Dividing of two Matrix in Java
Multiplication of two Matrix
. The Java two dimensional array  program is operate to the two matrix number... Multiplication of Two Matrix       This is a simple Java multidimensional array program
Merging Two Cells
Merging two cells       In this program we are going to merge two cells of an excel sheet through java program .You can merge any number of cells. The package we need
Dividing Element of Two Dimensional Array
;ArrayDivideMatrix". Here you will learn how to use two matrix array for developing Java program.  The java two dimensional array program is operate the two... Dividing  Element of Two Dimensional Array
Multiplication of two Matrix
for multiplying two matrix to each other. Here providing you Java source code... program that will multiply two matrix. Two dimensional array represents the matrix.  Now, make this program, you have to declare two multidimensional array
Display tow dimensional array by matrix form using one for loop in java
Display tow dimensional array by matrix form using one for loop in java  Display tow dimensional array by matrix form using one for loop in java
Find sum of all the elements of matrix using Java
Find sum of all the elements of matrix using Java A matrix is a rectangular array of numbers. The numbers in the matrix are called its entries or its elements. A matrix with m rows and n columns is called m-by-n matrix or m × n matrix
how to show x axis values of timeline chart in jfreechart with particular month.
how to show x axis values of timeline chart in jfreechart with particular month.  my x-axix timeline having day of 1 month and days shows me only differently and 1 month. I want month attached with days
A single dimensional array is called
A single dimensional array is called  What is a single dimensional array called?   A single dimensional array is called LIST
Two dimensional array in java
Two dimensional array in java. In this section you will learn about two-dimensional array in java with an example. As we know that array is a collection... dimensional array is defined as an "array of array". In java the element
Two- Dimensional Array - Java Beginners
Two- Dimensional Array  I am new in java programming. I am creating a two-dimensional array. This is my code ** class BinaryNumbers { public static void main(String[] args) { //create a two-dimensional array int ROWS = 21
Sum of two Matrix
Sum of  two Matrix       In this section, we are going to calculate the sum of two matrix... to this. In this program we are going to calculate the sum of two matrix. To make this program
Matrix Example in Java
Matrix Example in Java       In Java tutorial, you will learn about array and matrix. An array.... To make a program over the two dimensional array, first of all we have to declare
two dimansional array - Java Beginners
two dimansional array  Modify the following program so that it computes and prints the tables of powers from 1 to 15.( 1 to 15 to the power 1, Squared, and Cubed: like below) it should look like 1 1 1 2 4 8 3 9 27 and so
Java, matrix
Java, matrix  java program to get output on the basis of users choice... of matrix.   Hello Friend, Try this: import java.util.*; class...]; int[][] C = new int[2][2]; System.out.println("Enter elements for matrix
Affine Transform Example
you an example. We have create combo box to show shearing for x-axis and y-axis... will rotate with x-axis and y-axis if you sets shear. Download Source Code... ActionListener class is called.  The method getDefaultToolkit() of class
Matrix multiplication in java
two-dimensional array. Here we are going to develop a Java code for matrices...Matrix multiplication in java In this section we will learn about multiplication of two matrices. In java this is a simple program to multiply two matrices
Matrix - Java Beginners
Matrix  give me the Matrix program   Hi friend, Code for Matrix Example in Java class MatrixExample{ public static void main(String[] args) { int array[][]= {{1,3,5},{2,4,6
Need coding help - two dimensional matrix and it returns back a boolean.
Need coding help - two dimensional matrix and it returns back a boolean.  I need to write a code method that accepts a two dimensional integer arrays as the argument and returns true if the array or matrix is left or right
Array in Java
. Different types of array used in Java are One-dimensional, Two-dimensional and multi... is created. Each item in an array is called an element. First element... of an Array Initialization of an Array Arrays in Java for different data
Compare two char array in java
Description: This tutorial demonstrate how to compare two character array are equal or not. The Arrays.equals(c1, c2) helps to compare it and return boolean value. Code: import java.util.Arrays
The GE Matrix
by competitive/business strength. The matrix has been plotted in a two dimensional grid i.e. X and Y-axis, where the Y- axis represents the Market attractiveness and X...The GE matrix was developed by Mckinsey in 1970s for General Electric in order
Parallel multiplication matrix in java
Parallel multiplication matrix in java  hello dear I need parallel multiply matrix in java algorithm to account speed up and efficiency great wishes
Matrix Multiplication in Java
will write a simple program, which will multiply two matrix. A Two dimensional array...Matrix Multiplication in Java In this Java tutorial we will demonstrate you 'Matrix Multiplication in Java' with the help of a simple example from which you
matrix calculator - Java Beginners
matrix calculator  hi..... can you help me in writing source code of matrix calculator in java... i know you are the best you can do it!!! show yourself
matrix determination in java
matrix determination in java  hai
Matrix Addition using RMI in Java
Matrix Addition using RMI in Java  Source Code for Matrix Addition using RMI in Java
how to store array values into two different tables in java?
how to store array values into two different tables in java?  I have use 4/5 textboxes with same name(e.g.text1) and I get the values in a array and now I want to store these values in two different tables(i.e store 2 array
Two Dimensional Array Program
Two Dimensional Array Program Using Nested for loop...; program . In this session we will teach how to use of a two dimensional array... are going to make two dimensional array having three row and three columns.
Tutorials