We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7e5bf9b commit fe41264Copy full SHA for fe41264
scripts/algorithms/M/Maximum Swap/Maximum Swap.cpp
@@ -1,3 +1,4 @@
1
+// Runtime: 0 ms (Top 100.00%) | Memory: 5.8 MB (Top 87.89%)
2
class Solution {
3
public:
4
int maximumSwap(int num) {
@@ -12,7 +13,7 @@ class Solution {
12
13
maxIdx=i;
14
continue;
15
}
-
16
+
17
if(st_n[i]<maxNum)
18
{
19
leftidx=i;
@@ -21,9 +22,8 @@ class Solution {
21
22
23
if(leftidx==-1)
24
return num;
25
26
swap(st_n[leftidx],st_n[rightidx]);
27
return stoi(st_n);
28
29
};
0 commit comments