Skip to content

Commit 7c2af61

Browse files
committedJul 16, 2022
Clean Test Code
1 parent 8ddc8de commit 7c2af61

File tree

2 files changed

+145
-262
lines changed

2 files changed

+145
-262
lines changed
 

‎src/hackerrank/FlatlandSpaceStations/FlatlandSpaceStations.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ else if (noOfSpaceStations == 1) {
139139
// If first city is not a space station
140140
if (spaceStations[0] != 0) {
141141
maxDistance = spaceStations[0];
142+
142143
} else if ( spaceStations[0] == 0 ) {
143144
maxDistance = (spaceStations[1]-spaceStations[0])/2;
144145
}
@@ -165,6 +166,7 @@ else if (noOfSpaceStations == 1) {
165166
/**
166167
* The space stations are consecutive last,
167168
* i.e. They are the last ones.
169+
*
168170
* Given 5 cities with 2 space stations that
169171
* are in the end. i.e. Cities 3 and 4 are
170172
* the space stations.
@@ -175,8 +177,7 @@ else if (noOfSpaceStations == 1) {
175177
*
176178
* Get the first station spaceStations[0]
177179
*
178-
* How to confirm that space stations are
179-
* consecutive last?
180+
* Confirm that space stations are consecutive last
180181
*
181182
*/
182183
public static boolean areSpaceStationsConsecutiveLast(
@@ -190,10 +191,10 @@ public static boolean areSpaceStationsConsecutiveLast(
190191
return false;
191192

192193
int firstSpaceStation = spaceStations[0];
193-
int isLast = (lastSpaceStation - firstSpaceStation) -
194+
int consecutiveLast = (lastSpaceStation - firstSpaceStation) -
194195
(numberOfSpaceStations - 1);
195196

196-
return ( isLast == 0 ) ? true : false;
197+
return ( consecutiveLast == 0 ) ? true : false;
197198
}
198199
}
199200

0 commit comments

Comments
 (0)
Failed to load comments.