Created
April 1, 2017 10:42
-
-
Save kendhia/ae96626819cdcd1cd6b8641dd3aebdc1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package hackerank; | |
import java.io.*; | |
import java.util.*; | |
public class Solution { | |
public static void main(String[] args) { | |
Scanner scanner = new Scanner(System.in); | |
int numOfQueries = scanner.nextInt(); | |
for (int i = 0; i < numOfQueries; i++) { | |
int numOfCustomers = scanner.nextInt(); | |
int[] sumOfQueriesOfCustomer = new int[numOfCustomers]; | |
int stingyValue = 100; | |
int stingyIndex = 0; | |
for (int j =0; j < numOfCustomers; j++){ | |
for (int d = 0; d < numOfCustomers; d++){ | |
sumOfQueriesOfCustomer[j] += scanner.nextInt(); | |
} | |
if (sumOfQueriesOfCustomer[j] < stingyValue){ | |
stingyValue = sumOfQueriesOfCustomer[j]; | |
stingyIndex = j; | |
} | |
} | |
System.out.println(String.valueOf(stingyIndex+1)); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment