Skip to content

Commit 3d6002f

Browse files
committed
Runtime: 62 ms (Top 96.61%) | Memory: 25.4 MB (Top 58.20%)
1 parent 4eddf99 commit 3d6002f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

scripts/algorithms/H/Heaters/Heaters.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
// Runtime: 62 ms (Top 96.61%) | Memory: 25.4 MB (Top 58.20%)
12
class Solution {
23
public:
34
//we will assign each house to its closest heater in position(by taking the minimum
4-
//of the distance between the two closest heaters to the house) and then store the maximum
5+
//of the distance between the two closest heaters to the house) and then store the maximum
56
//of these differences(since we want to have the same standard radius)
67
int findRadius(vector<int>& houses, vector<int>& heaters) {
78
sort(heaters.begin(),heaters.end());
@@ -13,7 +14,7 @@ class Solution {
1314
if(index==heaters.size()){
1415
index--;
1516
}
16-
//the two closest positions to house will be heaters[index] and
17+
//the two closest positions to house will be heaters[index] and
1718
//heaters[index-1]
1819
int leftDiff=(index-1>=0)?abs(house-heaters[index-1]):INT_MAX;
1920
int rightDiff=abs(house-heaters[index]);

0 commit comments

Comments
 (0)