Skip to content

Commit fe41264

Browse files
committed
Runtime: 0 ms (Top 100.00%) | Memory: 5.8 MB (Top 87.89%)
1 parent 7e5bf9b commit fe41264

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

scripts/algorithms/M/Maximum Swap/Maximum Swap.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Runtime: 0 ms (Top 100.00%) | Memory: 5.8 MB (Top 87.89%)
12
class Solution {
23
public:
34
int maximumSwap(int num) {
@@ -12,7 +13,7 @@ class Solution {
1213
maxIdx=i;
1314
continue;
1415
}
15-
16+
1617
if(st_n[i]<maxNum)
1718
{
1819
leftidx=i;
@@ -21,9 +22,8 @@ class Solution {
2122
}
2223
if(leftidx==-1)
2324
return num;
24-
25+
2526
swap(st_n[leftidx],st_n[rightidx]);
2627
return stoi(st_n);
2728
}
2829
};
29-

0 commit comments

Comments
 (0)