Skip to content

Commit

Permalink
feat: 更新 sort answer
Browse files Browse the repository at this point in the history
  • Loading branch information
xjq7 committed Nov 19, 2022
1 parent 46e3414 commit ea2a9ee
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 10 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/qs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ on:
paths:
- 'question/FrontEnd/**'
- '.github/workflows/qs.yml'
- 'qs.mjs'
- '!question/FrontEnd/cache.json'
- '!question/FrontEnd/cache.prod.json'
pull_request:
branches: [main]
paths:
- 'question/FrontEnd/**'
- '.github/workflows/qs.yml'
- 'qs.mjs'
- '!question/FrontEnd/cache.json'
- '!question/FrontEnd/cache.prod.json'

Expand All @@ -42,7 +44,7 @@ jobs:

- name: Create local changes
run: |
pnpm qs:generate prod qstoken=${{ secrets.QS_TOKEN }}
pnpm qs:generate prod ${{ secrets.QS_TOKEN }}
- name: Commit files
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,13 @@ on:
- '.github/workflows/server.yml'
- '!server/config/nginx.conf'
- '!server/sql/**'
- '!server/qsdata/**'
pull_request:
branches: [main]
paths:
- 'server/**'
- '.github/workflows/server.yml'
- '!server/config/nginx.conf'
- '!server/sql/**'
- '!server/qsdata/**'

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
Expand Down
4 changes: 2 additions & 2 deletions qs.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ const args = process.argv.slice(2);

const isProd = !!args.find((arg) => arg === 'prod');

let qsToken = args.find((arg) => /qstoken=/.test(arg));
qsToken = qsToken.replace(/qstoken=/, '');
let qsToken = args.find((arg) => /QS_TOKEN=/.test(arg));
qsToken = qsToken.replace(/QS_TOKEN=/, '');

const cacheFile = isProd ? 'cache.prod.json' : 'cache.json';

Expand Down
2 changes: 1 addition & 1 deletion question/FrontEnd/cache.prod.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"amountThousandthsFormat":"c5769edfd07fbe31131bddccfb6affcff5f584cf930efdcef3853fbf3e7a3115","curry":"34daf8f9d968bd30f52083978db47e279f0be3a9bc3ad010dd91b31a6c852866","deepClone":"d59950508f0709bba97bb78a81c321004c430cc8303472eef963c5ccbb08ae85","deepMerge":"a9a3699b3679308f244c08845b324890859fac542dad7d7f00cf93f5343086cc","flatten":"a5eeb504b761ebd1487c0a02b9a2a86bc570b580b8807a2f5275610a8b48d29d","sort":"4b812ca790434ee9819bc10309abaa7ffb4a0831dda453293a41c94e4786392a","unique":"44979fd8039148151f6c5a964ce0217828053188363af31dd04264481316b1e0"}
{"amountThousandthsFormat":"c5769edfd07fbe31131bddccfb6affcff5f584cf930efdcef3853fbf3e7a3115","curry":"34daf8f9d968bd30f52083978db47e279f0be3a9bc3ad010dd91b31a6c852866","deepClone":"d59950508f0709bba97bb78a81c321004c430cc8303472eef963c5ccbb08ae85","deepMerge":"a9a3699b3679308f244c08845b324890859fac542dad7d7f00cf93f5343086cc","flatten":"a5eeb504b761ebd1487c0a02b9a2a86bc570b580b8807a2f5275610a8b48d29d","sort":"c30d24e91c4b1cf0ab65f0aec17cf814fe1c799250478f8af306cc151de28a3f","unique":"44979fd8039148151f6c5a964ce0217828053188363af31dd04264481316b1e0"}
20 changes: 20 additions & 0 deletions question/FrontEnd/sort/answer.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,23 @@ export default function sort(arr) {
### 方法二

快速排序

### 方法三

冒泡排序

```js
export default function sort(arr) {
let len = arr.length;
for (let i = 0; i < len - 1; i++) {
for (let j = 0; j < len - i; j++) {
if (arr[j] > arr[j + 1]) {
let temp = arr[j];
arr[j] = arr[j + 1];
arr[j + 1] = temp;
}
}
}
return arr;
}
```
1 change: 0 additions & 1 deletion server/src/qsdata/questions.json

This file was deleted.

Loading

0 comments on commit ea2a9ee

Please sign in to comment.