Click here to Skip to main content
15,879,326 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
class Solution
{
    public static int NumOffices(char[][] grid) 
    {
        int result = 0;
        
        
        return result;
    }
}

namespace Rextester
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var matrix = GetMatrix();
            var numOffices = Solution.NumOffices(matrix);
            Console.WriteLine(numOffices);
        }
        
        public static char[][] GetMatrix()
        {
            var rows = int.Parse(Console.ReadLine());
            var cols = int.Parse(Console.ReadLine());

            char[][] matrix = new char[rows][];
            for (var i = 0; i < rows; i++)
            {
                var line = Console.ReadLine();
                matrix[i] = line.ToCharArray();
            }
            return matrix;
        }
    }
}


What I have tried:

class Solution
{
    public static int NumOffices(char[][] grid) 
    {
        int result = 0;
        
        
        return result;
    }
}

namespace Rextester
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var matrix = GetMatrix();
            var numOffices = Solution.NumOffices(matrix);
            Console.WriteLine(numOffices);
        }
        
        public static char[][] GetMatrix()
        {
            var rows = int.Parse(Console.ReadLine());
            var cols = int.Parse(Console.ReadLine());

            char[][] matrix = new char[rows][];
            for (var i = 0; i < rows; i++)
            {
                var line = Console.ReadLine();
                matrix[i] = line.ToCharArray();
            }
            return matrix;
        }
    }
}
Posted
Updated 4-May-20 6:21am
Comments
phil.o 4-May-20 12:19pm    
Please use the green "Improve question" widget and describe the problem.
Member 14821687 4-May-20 12:38pm    
I don't know what to put in the "class Solution"
phil.o 4-May-20 12:47pm    
You have to iterate the array, counting whatever you have to count in the process. Read your course carefully, it contains invaluable material regarding your exercise.

1 solution

The NumOffices method is lacking the code to perform the computation which its name suggests.
 
Share this answer
 
Comments
BillWoodruff 4-May-20 14:18pm    
this is not a solution !
phil.o 4-May-20 14:38pm    
This is an answer to the question; not to the implied one, I agree, but to the formal one.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900