A multi-language playground for practicing programming katas and coding challenges from various platforms including Exercism, LeetCode, HackerRank, and Edabit.
A code kata is an exercise in programming which helps programmers hone their skills through practice and repetition
This repository contains implementations of coding challenges in multiple programming languages:
languages-kata-showcase/
├── c/ # C programming challenges
│ └── exercism/
│ ├── difference_of_squares/
│ └── grains/
├── go/ # Go programming challenges
│ └── exercism/
│ └── difference_of_squares/
├── javascript/ # JavaScript challenges with TDD
│ └── src/
│ ├── Edabit/ # Edabit challenges
│ ├── HackerRank/ # HackerRank challenges
│ └── LeetCode/ # LeetCode challenges
└── .vscode/ # VS Code configuration
- Exercism Challenges: Implementation of classic programming problems
- Features: Unit testing with custom test runner, header files, Makefile build system
- Current Challenges:
- Difference of Squares - Calculate the difference between square of sum and sum of squares
- Grains - Calculate grains on a chessboard
- Exercism Challenges: Go implementations with standard testing
- Features: Go modules, table-driven tests
- Current Challenges:
- Difference of Squares - Same problem as C version but in Go
- Multiple Platforms: LeetCode, HackerRank, and Edabit challenges
- Features: TDD with Mocha/Chai, ES6+ syntax, comprehensive test coverage
- Platforms Covered:
- LeetCode: Array manipulation, binary operations
- HackerRank: Interview preparation problems
- Edabit: Various difficulty levels from beginner to advanced
- C: GCC compiler, Make
- Go: Go 1.21+
- JavaScript: Node.js, npm/yarn
cd c/exercism/difference_of_squares
make test
cd go/exercism/difference_of_squares
go test -v
cd javascript
# Install dependencies
npm install
# Run all tests
npm test
# Run specific kata
npm test "kata-name"
# Run tests in watch mode
npm run test:tdd
Available in: C, Go
Calculate the difference between the square of the sum and the sum of the squares of the first N natural numbers.
- Square of sum: (1 + 2 + ... + N)²
- Sum of squares: 1² + 2² + ... + N²
- Difference: Square of sum - Sum of squares
Example: For N=10
- Square of sum: (1+2+...+10)² = 55² = 3025
- Sum of squares: 1²+2²+...+10² = 385
- Difference: 3025 - 385 = 2640
LeetCode Examples:
- Build Array from Permutation - Array manipulation
- Convert Binary to Integer - Binary operations
Edabit Examples:
- FizzBuzz - Classic programming problem
- Arithmetic Progression - Mathematical sequences
- Capitalize by ASCII - String manipulation
HackerRank Examples:
- Mini Max Sum - Array algorithms
- Diagonal Difference - Matrix operations
Custom test runner with assertions:
assert(square_of_sum(10) == 3025);
printf("✓ test_square_of_sum_ten passed\n");
Table-driven tests:
tests := []struct {
name string
input int
expected int
}{
{"ten", 10, 3025},
}
Mocha with Chai for BDD-style testing:
describe('FizzBuzz', () => {
it('should return "Fizz" if divisible by 3', () => {
expect(calculate(9)).to.be.equal('Fizz');
});
});
The project includes VS Code settings for:
- C/C++ IntelliSense configuration
- Language-specific formatting
- Integrated terminal support
- JavaScript: ESLint with Airbnb config, Babel for ES6+ support
- C: Wall, Wextra compiler flags for strict compilation
- Go: Built-in formatting and testing tools
- Fork the repository
- Create a feature branch:
git checkout -b my-new-kata
- Add your solution with tests
- Commit your changes:
git commit -m 'Add solution for XYZ kata'
- Push to the branch:
git push origin my-new-kata
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE.md file for details.
- Exercism: For providing excellent programming exercises
- LeetCode: For algorithm and data structure challenges
- HackerRank: For interview preparation problems
- Edabit: For diverse coding challenges