Skip to content

Commit

Permalink
Merge pull request #1 from LinuxSuRen/master
Browse files Browse the repository at this point in the history
initial project
  • Loading branch information
LinuxSuRen authored Jan 24, 2024
2 parents 18d3561 + 53d41a7 commit 7528fbd
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/generator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: generator

on:
push:
branches: [ master ]

workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'ci skip')"

steps:
- uses: actions/[email protected]
- name: Update readme
uses: linuxsuren/[email protected]
env:
GH_TOKEN: ${{ secrets.GH_SECRETS }}
with:
pattern: 'items/*.yaml'
username: linuxsuren
org: devops-ws
repo: learn-code
sortby: '!rank'
8 changes: 8 additions & 0 deletions README.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# learn-code
Improve your code skills via LeetCode

| 题目 | 难度 |
|---|---|---|
{{- range $val := .}}
| [{{$val.description}}]({{$val.link}}) | {{$val.rank}} |
{{- end}}
33 changes: 33 additions & 0 deletions items/palindrome.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
description: 回文数
rank: 1
link: https://leetcode.cn/problems/palindrome-number/
---

```golang
func isPalindrome(num int) bool {
if num < 0 {
return false
}
if num == 0 {
return true
}
nums := make([]int, 0)
var token int
var count int

for num != 0 {
token = num % 10
nums = append(nums, token)
count++
num /= 10
}

for i := 0; i < count / 2; i++ {
if nums[i] != nums[count-i-1] {
return false
}
}
return true
}
```

0 comments on commit 7528fbd

Please sign in to comment.