Skip to content

Commit 1faf3cc

Browse files
authored
Update longest-square-streak-in-an-array.cpp
1 parent 0f72b26 commit 1faf3cc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

C++/longest-square-streak-in-an-array.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class Solution2 {
3434
unordered_map<int, int> dp;
3535
int result = 0;
3636
for (const auto& x : nums) {
37-
const int sqrt_x = static_cast<int>(sqrt(x) + 0.5);
37+
const int sqrt_x = static_cast<int>(sqrt(x));
3838
if (sqrt_x * sqrt_x == x) {
3939
dp[x] = dp[sqrt_x] + 1;
4040
} else {

0 commit comments

Comments
 (0)