Kotlin coding puzzles
This repository contains a set of programming puzzles that are solved using Kotlin language (hints, solutions tests and useful links are here as well). Purpose of this repository is to help you to practice coding and develop strong problem-solving skills. This will help you to become better programmer and improve you chance of getting a new job, by passing whiteboard coding interview.
Each puzzle is located in separate package and it contains of 3 main files (screen):
Puzzle.md- description of the task.
Puzzle.kt- empty method/class where puzzle should be solved. This file also contains helper methods and a set of JUnit tests which verifies if task was solved correctly.
PuzzleSolution.kt- file that contains one or more solutions.
Keep in mind that each puzzle will usually have more than one solution. Even simple puzzle like String reversal can be solved in 10 different ways. Usually, we compare various solutions using (Big O notation) to determine space/time complexity and we look at code readability.
How do I start?
Let's solve some puzzles
Some puzzle may contain a reference to other puzzles that should be solved before to have better understanding of the problem. To succeed you need to practice often, repeat same puzzles multiple times and be persistent over time. Take your time before you take a look at the presented solution. Good luck!
New in Town
- Capitalize sentence
- Get odd numbers
- Range contains range?
- Add up to
- Linear search
- Count down
- Count up and down
- Format train route
- Generate all pairs
- Count unique values
- Print number
- Print number with steps
- Capitalize first
- Decapitalize const
- Longest word
- Is palindrome
- Is tolerant palindrome
- Is anagram
- Max occurring char
- String reverse
- Find the vowels
- Int reverse
- Pyramid generator
- Steps generator
- Fizz Buzz
- Caesar Cipher
- Has repeated char
- Spiral matrix generator
- Combine queues
- Bubble sort
- Selection sort
- Square equals
- Sum zero
- Digit frequency
- Get duplicated arguments
- Find pair with target average
- Binary search tree
- Tree traversal
- Tree level width
- Binary search tree (insert)
- Binary search tree (validate)
- Any callback
- Binary search
- Surrounded letter
- Insertion sort
- Quick sort
- Radix sort
- Doubly linked list
- Max binary heap
- List chunk
- Singly linked list
- Linked list midpoint
- Circular check
- Linked list take n-th element from last
- Is sub string
- Merge sort
- Fibonacci with recursive cache
- Max sub list sum
- Min sub list length
More codding challenges
- GeeksForGeeks - large and nicely segregated set of problems.
- HackerRank - large set of problems and additional interview problems for business.
- Project euler - more complex challenges, usually related to mathematics. Site already contains 600+ problems and a new code challenge is available very week or two. You will probably have to discuss problem with community because solutions are not on the website.
- Advent of code - one month of various programing problems released daily at the end of the year. Fortunately archive of past events is still there.
- Code Google Com Codejam - Google Code Jam, calls on programmers around the world to solve challenging, algorithmic puzzles against the clock. They publish all the past problems on their website.
- CoderByte - 200+ challenges, data structures / algorithms / company interview problems segregated by difficulty. Unfortunately most of them is only available for premium users. Premium gives you access to premium step-by-step solutions and user solutions.
- CodeChef - contains set of programming problems segregated by difficulty.
- LeetCode - data structures / algorithms / company interview problems segregated by difficulty.
- Code Forces - list of programming puzzles is smaller than other websites, but you will still have plenty problems to solve.
- Spoj - list of programming puzzles is smaller than other websites, but you will still have plenty problems to solve.
- The Coding Interview Bootcamp Algorithms + Data Structures
- Master the Coding Interview Data Structures + Algorithms
- Data Structures and Algorithms Deep Dive Using Java
- Cracking the Coding Interview, 6th Edition
- Algorithms, 4th Edition
- Introduction to Algorithms, 3rd Edition (The MIT Press)
- More books...
- Hiring without whiteboards - listing of companies (or teams) that don't do "whiteboard" interviews.
- VisuAlgo - visualizes data structures and algorithms through animations algorithms.
- Data structures explained - description of various data structures.
- Sorting algorithms animations - visually compares most popular sorting algorithms using animations.
- Big-O Reference - summarizes the complexities in terms of space and time (Big-O) of the most important algorithms and operations in common data structures.
- Big-O poster - time/space complexity poster to print ant put on the wall.
- Big-O Cheat Sheet - covers the space and time Big-O complexities of common algorithms.
Coding interview repositories
If you think something is incorrect, have a better solution, give feedback or simply you want to add new coding puzzle just create PR or open a new issue.