LeetCode problems solved in APL (A Programming Language)
This project was created with AI assistance. All APL solutions and explanations in this repository were generated using artificial intelligence. While efforts have been made to ensure code quality:
- Solutions may contain errors or non-optimal approaches
- Code has not been extensively tested in production APL interpreters
- Explanations are based on code analysis and may not reflect APL best practices
- This is primarily an educational/experimental project
Use at your own discretion. Contributions and corrections are welcome!
๐ Languages: English | ็น้ซไธญๆ | ็ฎไฝไธญๆ | ๆฅๆฌ่ช | Espaรฑol | Deutsch | Franรงais
- ๐ข Easy: 70+
- ๐ก Medium: 50+
- ๐ด Hard: 10+
# Install APL
brew install gnu-apl # macOS
apt install gnu-apl # Linux
# Browse solutions
cd problems/001-two-sum
cat 001-two-sum.jsonReverseList โ {โฝโต}Complexity: Time O(n), Space O(1)
problems/
โโโ 001-two-sum/
โ โโโ README.md # English
โ โโโ README.zh-CN.md # ็ฎไฝไธญๆ
โ โโโ README.zh-TW.md # ็น้ซไธญๆ
โ โโโ README.ja.md # ๆฅๆฌ่ช
โ โโโ README.es.md # Espaรฑol
โ โโโ README.de.md # Deutsch
โ โโโ README.fr.md # Franรงais
โโโ 136-single-number/
โ โโโ ... (7 language files)
โโโ 206-reverse-linked-list/
โโโ ... (7 language files)
This repository provides documentation in 7 languages:
| Language | README |
|---|---|
| ๐ฌ๐ง English | README.md |
| ๐น๐ผ ็น้ซไธญๆ | README.zh-TW.md |
| ๐จ๐ณ ็ฎไฝไธญๆ | README.zh-CN.md |
| ๐ฏ๐ต ๆฅๆฌ่ช | README.ja.md |
| ๐ช๐ธ Espaรฑol | README.es.md |
| ๐ฉ๐ช Deutsch | README.de.md |
| ๐ซ๐ท Franรงais | README.fr.md |
Each problem file in the problems/ directory also includes descriptions and explanations in all 7 languages.
- โ 100+ Classic Problems: Comprehensive coverage of LeetCode's most important problems
- โ APL Solutions: Unique implementations using APL's powerful array operations
- โ Detailed Explanations: Each solution includes complexity analysis and explanations
- โ 7 Languages: Full documentation in English, ็นไธญ, ็ฎไธญ, ๆฅๆฌ่ช, Espaรฑol, Deutsch, Franรงais
- โ Modular Structure: Each problem in its own JSON file for easy navigation
- โ Educational Focus: Learn array programming through practical examples
- โ Open Source: MIT licensed, contributions welcome
TwoSum โ {
โ โบ: target sum, โต: array
indices โ โธโบ=+/โ.,โจโต
2โindices
}
โ Usage
target โ 9
nums โ 2 7 11 15
result โ target TwoSum nums โ Returns: 0 1Explanation: Uses outer product โ. to generate all possible pair sums, then โธ to find matching indices.
- Time Complexity: O(nยฒ)
- Space Complexity: O(nยฒ)
SingleNumber โ {โ /โต}
โ Usage
nums โ 4 1 2 1 2
result โ SingleNumber nums โ Returns: 4Explanation: XOR reduce - APL's โ is XOR, / is reduce. Elegant one-liner leveraging XOR properties.
- Time Complexity: O(n)
- Space Complexity: O(1)
ReverseList โ {โฝโต}
โ Usage
list โ 1 2 3 4 5
result โ ReverseList list โ Returns: 5 4 3 2 1Explanation: โฝ is APL's reverse operator - the simplest possible solution!
- Time Complexity: O(n)
- Space Complexity: O(1)
- Language: APL (A Programming Language)
- Documentation: Pure Markdown (Static)
- Format: JSON data + Markdown READMEs
- i18n: 7 languages (English, ็ฎไธญ, ็นไธญ, ๆฅๆฌ่ช, Espaรฑol, Deutsch, Franรงais)
- Hosting: GitHub (static files)
leetcode-apl-solutions/
โโโ problems/ # All problem solutions
โ โโโ 001-two-sum/ # Each problem in its own directory
โ โ โโโ README.md # 7 language versions
โ โ โโโ README.zh-CN.md
โ โ โโโ ...
โ โโโ 136-single-number/
โ โโโ 206-reverse-linked-list/
โ โโโ index.json # Problem metadata
โโโ PROBLEMS_INDEX.md # Complete problem list (7 languages)
โโโ PROBLEMS_INDEX.zh-CN.md
โโโ README.md # Main documentation (7 languages)
โโโ README.zh-CN.md
โโโ generate_static_readmes.py # Generator script
Simply browse this repository on GitHub! No server needed - everything is static Markdown files.
- Start here: PROBLEMS_INDEX.md - Complete list of all problems
- Click any problem to view its full solution with explanation
- Switch languages using the navigation bar at the top of each page
git clone https://github.com/wmh/leetcode-apl-solutions.git
cd leetcode-apl-solutions
# View complete problem list
cat PROBLEMS_INDEX.md
# Browse a specific problem
cat problems/001-two-sum/README.md
# View in Chinese
cat problems/001-two-sum/README.zh-CN.mdTo actually run the APL code, you'll need an APL interpreter:
- Online (easiest): Visit TryAPL.org
- Dyalog APL: Download from dyalog.com
- GNU APL:
- Linux:
apt install gnu-apl - macOS:
brew install gnu-apl
- Linux:
Use the included generator script to create new problem READMEs:
# Add your problem data to problems/*.json
# Then regenerate all READMEs
python3 generate_static_readmes.pyContributions are welcome! Here's how you can help:
- Add More Problems: Implement additional LeetCode problems in APL
- Improve Solutions: Optimize existing APL solutions
- Fix Bugs: Report and fix any issues you find
- Translations: Help improve language translations
- Documentation: Enhance problem explanations
See HOW_TO_ADD_PROBLEMS.md for detailed instructions on adding new problems.
Quick steps:
- Create a JSON file in
problems/with your solution - Run
python3 generate_static_readmes.py - Commit and push your changes
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- APL Wiki - Comprehensive APL documentation
- Dyalog APL Tutorial - Official Dyalog tutorial
- APL Cart - Searchable APL idioms
- Try APL - Online APL interpreter
- LeetCode Problems - Official problem list
- LeetCode Top Interview Questions
This project is licensed under the MIT License - see the LICENSE file for details.
- Kenneth E. Iverson - Creator of APL
- LeetCode - For providing excellent algorithmic problems
- Dyalog Ltd - For maintaining and developing APL
- APL Community - For keeping this beautiful language alive
- GitHub: @wmh
- Issues: Report issues or suggestions
If you find this project helpful, please consider giving it a star! โญ
Made with โค๏ธ and lots of โต, โบ, โฝ, and โ
"APL is a mistake, carried through to perfection. It is the language of the future for the programming techniques of the past: it creates a new generation of coding bums." - Edsger W. Dijkstra
"APL is like a perfect diamond: flawless, beautifully symmetrical, but you can't do anything with it." - Unknown
Despite the criticisms, APL remains one of the most elegant and powerful languages for array manipulation! ๐ฏ