Skip to content

guyko/interview

Repository files navigation

🧠 Algorithm Interview Prep - LeetCode Solutions in Kotlin & Java

A comprehensive collection of algorithmic coding solutions for technical interviews, coding interviews, and competitive programming. This repository contains optimal solutions to popular LeetCode problems, coding challenges, and common software engineering interview questions, implemented in Kotlin and Java with detailed explanations.

Perfect for: Software Engineers, Computer Science Students, Interview Preparation, Algorithm Practice, Data Structures Learning, Competitive Programming

Build Status Java Version Kotlin Version License LeetCode Algorithms

🏆 Why This Repository?

  • 23+ Algorithm Solutions with optimal time/space complexity
  • Interview-Ready Code used by software engineers at top tech companies
  • Detailed Explanations for each algorithm and approach
  • Multiple Programming Languages (Kotlin, Java)
  • Production Quality with comprehensive test coverage
  • Big O Analysis for every solution
  • Real Interview Questions from Google, Microsoft, Amazon, Facebook
  • Regular Updates with new problems and solutions

🚀 Quick Start

Prerequisites

  • Java 11 or higher
  • Maven 3.6+

Building and Running Tests

# Clone the repository
git clone https://github.com/guyko/interview.git
cd interview

# Compile the project
mvn compile

# Run all tests
mvn test

# Build JAR package
mvn package

📚 Problem Categories

🔍 Array & Two Pointers

🔤 String Processing

🔍 Binary Search

📊 Dynamic Programming

🌲 Trees & Data Structures

⏰ Intervals & Scheduling

🧮 Mathematical Problems

🏗️ Architecture

Project Structure

src/
├── main/java/com/guyko/
│   └── App.java              # Simple main application
└── test/java/com/guyko/
    ├── TestTwoSum.kt         # Array problems (Two Sum)
    ├── TestValidParentheses.kt # Stack-based problems
    ├── TestPalindrome.kt     # String palindrome problems
    ├── TestBinarySearch.kt   # Binary search variants
    ├── TestClimbingStairs.kt # Dynamic programming
    ├── TestMergeIntervals.kt # Interval problems
    ├── TestSubSum.kt         # Maximum subarray (Kadane's)
    ├── TestRegex1.kt         # Pattern matching
    ├── TestSubstrings.kt     # String manipulation
    ├── TestTree.kt           # Binary tree operations
    ├── TestLinked.kt         # Linked list algorithms
    ├── TestKakuro.kt         # Combinatorial puzzles
    └── TestYearWithMaxPeople.kt # Timeline algorithms

Technology Stack

  • Language: Kotlin 2.0.21 with Java 11
  • Build Tool: Maven 3.x
  • Testing: JUnit 4.13.2
  • Development: IntelliJ IDEA / VS Code

📖 Solution Approach

Each problem includes:

  1. 📝 Problem Description - Clear explanation of the problem
  2. 💡 Algorithm Explanation - Step-by-step approach
  3. ⚡ Time & Space Complexity - Big O analysis
  4. 🧪 Test Cases - Comprehensive test coverage
  5. 💻 Clean Implementation - Production-ready code

Example Solution Structure

/**
 * LeetCode #1: Two Sum
 * Given an array of integers nums and an integer target, return indices of the two numbers
 * such that they add up to target.
 * 
 * Time Complexity: O(n)
 * Space Complexity: O(n)
 */
private fun twoSum(nums: IntArray, target: Int): IntArray {
    val map = mutableMapOf<Int, Int>()
    
    for (i in nums.indices) {
        val complement = target - nums[i]
        if (map.containsKey(complement)) {
            return intArrayOf(map[complement]!!, i)
        }
        map[nums[i]] = i
    }
    
    throw IllegalArgumentException("No two sum solution")
}

🎯 Key Features

  • Production Quality Code - Clean, readable, and well-documented
  • Comprehensive Testing - Full test coverage with edge cases
  • Optimal Solutions - Time and space efficient algorithms
  • Latest Kotlin - Modern language features and best practices
  • Security Focused - No vulnerable dependencies
  • CI Ready - Maven build system with security scanning

🔧 Development

Running Specific Tests

# Run a specific test class
mvn test -Dtest=TestTwoSum

# Run tests with pattern matching
mvn test -Dtest="*BinarySearch*"

# Run all tests in a package
mvn test -Dtest="com.guyko.*"

Code Quality

# Compile with full warnings
mvn compile -Xlint:all

# Generate documentation
mvn javadoc:javadoc

# Create source and javadoc JARs
mvn package

📊 Complexity Analysis

Problem Category Time Complexity Space Complexity Difficulty
Two Sum O(n) O(n) Easy
Valid Parentheses O(n) O(n) Easy
Binary Search O(log n) O(1) Easy
Maximum Subarray O(n) O(1) Medium
Merge Intervals O(n log n) O(n) Medium
Longest Palindrome O(n²) O(1) Medium
Regular Expression O(mn) O(mn) Hard

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/new-algorithm)
  3. Add your solution with comprehensive tests
  4. Ensure all tests pass (mvn test)
  5. Submit a pull request

Contribution Guidelines

  • Follow existing code style and patterns
  • Include detailed problem description and complexity analysis
  • Add comprehensive test cases
  • Document your approach with comments

📄 License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

📖 Documentation

📚 Study Guides

🎯 Quick Navigation

🔍 SEO Keywords

Popular Searches: algorithm interview questions, leetcode solutions kotlin, coding interview prep, data structures algorithms, software engineer interview, technical interview preparation, java kotlin algorithms, computer science interview questions, programming interview practice, FAANG interview prep

Programming Languages: Kotlin algorithms, Java algorithms, JVM algorithms, Android interview prep, backend interview questions

Topics: binary search interview, dynamic programming leetcode, tree algorithms interview, string algorithms coding, array algorithms interview, hash table interview questions

🔗 Resources

🌟 Success Stories

"Used this repo to prepare for my Google interview. The Kotlin solutions are clean and the explanations helped me understand the patterns!" - Software Engineer at Google

"Perfect for Android developers who want to practice algorithms in Kotlin. Got my dream job at a startup!" - Mobile Developer

"The complexity analysis saved me so much time. Finally understand when to use which algorithm." - CS Student

🎯 GitHub Topics

algorithms leetcode kotlin java interview-preparation coding-interview data-structures computer-science software-engineering technical-interview programming android jvm maven algorithms-and-data-structures leetcode-solutions interview-questions coding-practice software-developer programming-interviews


⭐ Star this repository if it helps with your interview prep!

🔗 Share with fellow developers preparing for technical interviews

🤝 Contribute new solutions and help build the best algorithm resource

Happy Coding & Good Luck with Your Interviews! 🚀

About

No description, website, or topics provided.

Resources

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages