MCPcopy Create free account
hub / github.com/SAKET-SK/Programming-Aptitude-Interview-Prep / main

Method main

TCS/Que 4/Solution.java:4–30  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

2class Solution
3{
4 public static void main(String[] args)
5 {
6 Scanner sc=new Scanner(System.in);
7 int row=sc.nextInt();
8 int col=sc.nextInt();
9 int arr[][]=new int[row][col];
10
11 for(int i=0;i<row;i++)
12 for(int j=0;j<col;j++)
13 arr[i][j]=sc.nextInt();
14
15 int max=0,count=0,index=0;
16 for(int i=0;i<row;i++)
17 { count=0;
18 for(int j=0;j<col;j++)
19 {
20 if(arr[i][j]==1)
21 count++;
22 }
23 if(count>max)
24 {
25 max=count;
26 index=i+1;
27 }
28 }
29 System.out.println(index);
30 }
31}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected