Updated README #9
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Organize LeetCode Solutions | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| organize: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v3 | |
| - name: Organize files | |
| run: | | |
| mkdir -p BinarySearch Arrays Strings LinkedList Stack Queue HashTable Trees Graphs DynamicProgramming Greedy Backtracking Recursion SlidingWindow TwoPointers Heap Trie UnionFind BitManipulation Math PrefixSum Sorting BFS DFS | |
| for file in *.java; do | |
| content=$(cat "$file" | tr '[:upper:]' '[:lower:]') | |
| if echo "$content" | grep -q "binary search"; then | |
| cp "$file" BinarySearch/ | |
| elif echo "$content" | grep -q "sliding window"; then | |
| cp "$file" SlidingWindow/ | |
| elif echo "$content" | grep -q "two pointers"; then | |
| cp "$file" TwoPointers/ | |
| elif echo "$content" | grep -q "dynamic programming"; then | |
| cp "$file" DynamicProgramming/ | |
| elif echo "$content" | grep -q "backtracking"; then | |
| cp "$file" Backtracking/ | |
| elif echo "$content" | grep -q "recursion"; then | |
| cp "$file" Recursion/ | |
| elif echo "$content" | grep -q "greedy"; then | |
| cp "$file" Greedy/ | |
| elif echo "$content" | grep -q "heap\|priority queue"; then | |
| cp "$file" Heap/ | |
| elif echo "$content" | grep -q "trie"; then | |
| cp "$file" Trie/ | |
| elif echo "$content" | grep -q "union find"; then | |
| cp "$file" UnionFind/ | |
| elif echo "$content" | grep -q "bit manipulation"; then | |
| cp "$file" BitManipulation/ | |
| elif echo "$content" | grep -q "prefix sum"; then | |
| cp "$file" PrefixSum/ | |
| elif echo "$content" | grep -q "sorting"; then | |
| cp "$file" Sorting/ | |
| elif echo "$content" | grep -q "graph"; then | |
| cp "$file" Graphs/ | |
| elif echo "$content" | grep -q "bfs"; then | |
| cp "$file" BFS/ | |
| elif echo "$content" | grep -q "dfs"; then | |
| cp "$file" DFS/ | |
| elif echo "$content" | grep -q "tree"; then | |
| cp "$file" Trees/ | |
| elif echo "$content" | grep -q "linked list"; then | |
| cp "$file" LinkedList/ | |
| elif echo "$content" | grep -q "stack"; then | |
| cp "$file" Stack/ | |
| elif echo "$content" | grep -q "queue"; then | |
| cp "$file" Queue/ | |
| elif echo "$content" | grep -q "hash"; then | |
| cp "$file" HashTable/ | |
| elif echo "$content" | grep -q "string"; then | |
| cp "$file" Strings/ | |
| elif echo "$content" | grep -q "array"; then | |
| cp "$file" Arrays/ | |
| elif echo "$content" | grep -q "math"; then | |
| cp "$file" Math/ | |
| fi | |
| done | |
| - name: Commit changes | |
| run: | | |
| git config --global user.name "github-actions" | |
| git config --global user.email "actions@github.com" | |
| git add . | |
| git commit -m "Auto organize LeetCode solutions by topic (copy mode)" || echo "No changes" | |
| git push |