MCPcopy Create free account
hub / github.com/Rohit91singh9/Coding-DP-DSA / Solution

Class Solution

BuildingsWithWifi.java:62–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60
61
62public class Solution {
63
64 public static void main(String[] args) throws IOException {
65 BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
66
67 BufferedWriter bufferWriter = new BufferedWriter(new FileWriter(System.getenv("OUTPUT_PATH")));
68
69 int buildingCountCount = Integer.parseInt(bufferedReader.readLine().trim());
70
71 List<Integer> buildingCount = IntStream.range(0, buildingCountCount).mapToObj(i -> {
72
73 try {
74 return bufferedReader.readLine().replaceAll("\\s+$", "");
75 }
76 catch (IOException ex) {
77 throw new RuntimeException(ex);
78 }
79
80 })
81.map(String::trim)
82.map(Integer::parseInt)
83.collect(toList());
84
85int routerLocationCount = Integer.parseInt (bufferedReader.readLine() .trim());
86
87
88List<Integer> routerLocation = IntStream.range(0, routerLocationCount).mapToObj(i -> {
89
90try {
91return bufferedReader.readLine().replaceAll("\\s+$", "");
92}
93catch (IOException ex) {
94 throw new RuntimeException(ex) ;
95}
96
97})
98.map(String::trim)
99.map(Integer::parseInt)
100.collect(toList());
101
102int routerRangeCount = Integer.parseInt (bufferedReader.readLine().trim());
103
104List<Integer> routerRange = IntStream.range(0, routerRangeCount).mapToObj (i -> {
105
106 try {
107 return bufferedReader.readLine().replaceAll("\\s+$", "");
108 }
109 catch (IOException ex) {
110 throw new RuntimeException(ex);
111 }
112})
113
114.map(String::trim)
115.map(Integer::parseInt)
116.collect(toList());
117
118int result = Result.getServedBuildings(buildingCount, routerLocation, routerRange);
119

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected