Skip to content

guicarneiro11/leetcode_solutions_kotlin

Repository files navigation

LeetCode Solutions in Kotlin

This repository contains my solutions to LeetCode problems, implemented in Kotlin. Each solution includes unit tests and performance analysis.

🚀 Project Structure

src/
├── main/kotlin/
│   ├── datastructures/    # Data structure implementations
│   ├── algorithms/        # Core algorithms
│   └── leetcode/         # LeetCode solutions
│       └── easy/
│           └── arrays/
│               └── TwoSum.kt
└── test/kotlin/
    └── leetcode/
        └── easy/
            └── arrays/
                ├── TwoSumTest.kt
                └── TwoSumPerformanceTest.kt

📝 Solved Problems

Arrays and Hashing

1. Two Sum (Easy)

  • Problem: LeetCode - Two Sum
  • Solutions:
    • Brute Force (O(n²))
    • Optimized with HashMap (O(n))
  • Performance:
    • Detailed runtime analysis
    • Memory usage comparison
    • View Solution

🔍 Running Tests

# Run all tests
./gradlew test

# Run tests for a specific problem
./gradlew test --tests "leetcode.easy.arrays.TwoSumTest"

# Run performance tests
./gradlew test --tests "leetcode.easy.arrays.performance.TwoSumPerformanceTest"

📊 Performance Analysis

Each solution includes:

  • Performance tests with different input sizes
  • Time and space complexity analysis
  • Comparison between different approaches
  • Runtime distribution visualization

🛠️ Tech Stack

  • Kotlin 1.9.0
  • JUnit 5
  • Gradle

📌 Coding Standards

Each solution includes:

  • Documentation with time/space complexity
  • Unit tests
  • Performance tests
  • Multiple approaches (when relevant)

🎯 Next Problems

  • Valid Parentheses
  • Climbing Stairs
  • Binary Search
  • Reversed Linked List
  • Palindrome Number
  • Contains Duplicate
  • Valid Anagram
  • Maximum Subarray

🤝 Contributing

Feel free to:

  1. Suggest improvements to existing solutions
  2. Propose new solutions
  3. Report bugs
  4. Add more test cases

📖 Study Resources

About

Repo for algorithms in Kotlin

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages