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 7c33893 commit c70440aCopy full SHA for c70440a
problems/0283.移动零.md
@@ -133,6 +133,27 @@ var moveZeroes = function(nums) {
133
};
134
```
135
136
+TypeScript:
137
+
138
+```typescript
139
+function moveZeroes(nums: number[]): void {
140
+ const length: number = nums.length;
141
+ let slowIndex: number = 0,
142
+ fastIndex: number = 0;
143
+ while (fastIndex < length) {
144
+ if (nums[fastIndex] !== 0) {
145
+ nums[slowIndex++] = nums[fastIndex];
146
+ };
147
+ fastIndex++;
148
+ }
149
+ while (slowIndex < length) {
150
+ nums[slowIndex++] = 0;
151
152
+};
153
+```
154
155
156
157
158
-----------------------
159
<div align="center"><img src=https://code-thinking.cdn.bcebos.com/pics/01二维码一.jpg width=500> </img></div>
0 commit comments