top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Find Largest Area Triangle from 2D Matrix

+2 votes
308 views

Problem
Given a table of size n * m, with each cell having a color value from the set {r, g, b}, find the area of the largest triangle that has one side parallel with the y – axis (vertical) and has no two vertices that have the same color value.

Input
First line contains the size of the matrix i.e. n * m where n is the number of rows and m is the number of columns.
n lines follow each having a string of size m.

Output
A single value for the area of the triangle.

Provide the C Code for the above problem?

posted Aug 18, 2016 by Mohammed Hussain

Looking for an answer?  Promote on:
Facebook Share Button Twitter Share Button LinkedIn Share Button

Similar Questions
+6 votes

I was trying to get maximum rectangle area for a given histogram but I used brute force approach which have O(n^2) time complexity so I want some better solution using stack so that we could reduce time complexity to O(n) or O(log n ).

+3 votes

Please help me by sharing algo or C code?

+2 votes

Given bigger NxN matrix and a smaller MxM matrix print TRUE if the smaller matrix can be found in the bigger matrix else print FALSE

...