MCPcopy Create free account
hub / github.com/Ayush7614/Daily-Coding-DS-ALGO-Practice / main

Method main

Hackerank/Java/Pairs.java:32–59  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

30 private static final Scanner scanner = new Scanner(System.in);
31
32 public static void main(String[] args) throws IOException {
33 BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(System.getenv("OUTPUT_PATH")));
34
35 String[] nk = scanner.nextLine().split(" ");
36
37 int n = Integer.parseInt(nk[0]);
38
39 int k = Integer.parseInt(nk[1]);
40
41 int[] arr = new int[n];
42
43 String[] arrItems = scanner.nextLine().split(" ");
44 scanner.skip("(\r\n|[\n\r\u2028\u2029\u0085])?");
45
46 for (int i = 0; i < n; i++) {
47 int arrItem = Integer.parseInt(arrItems[i]);
48 arr[i] = arrItem;
49 }
50
51 int result = pairs(k, arr);
52
53 bufferedWriter.write(String.valueOf(result));
54 bufferedWriter.newLine();
55
56 bufferedWriter.close();
57
58 scanner.close();
59 }
60}

Callers

nothing calls this directly

Calls 2

pairsMethod · 0.95
skipMethod · 0.80

Tested by

no test coverage detected