This repository contains a set of programming challenges that are intended to be solved by using the Kotlin language (hints, solutions tests and useful links are here as well).
The purpose of this repository is to help you to practice coding and develop strong problem-solving skills. This will help you to become a better programmer and improve your chance of getting a new job by passing whiteboard coding interviews.
Each challenge is located in a separate package, and it contains 3 main files (screen):
README.md
- the task description.Challenge.kt
- file containing an empty method/class where the challenge should be solved. This file also contains a set of tests and occasionally helper methods. You can run all tests directly from this file (click the green arrow next toTest
class). JUnit tests which verify that the task was solved correctly.Solution.kt
- a file containing one or more solutions.
Keep in mind that each challenge will usually have more than one solution. Even simple challenges 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.
- Install IntelliJ IDEA
- Import the project by using the IntelliJ IDEA menu:
File | New | Project From Version Control | Git
- Choose a challenge (src\test\kotlin\com\igorwojda package) and code
the solution in the
Challenge.kt
file - Run the tests in the
Challenge.kt
file to verify the provided solution
The challenges below are segregated by different difficulties. The repository also contains challenges grouped by problem type.
Some challenges may contain a reference to other challenges that should be solved before to have a better understanding of the problem. Check the look at problem-solving strategy .
Take your time before you view the presented solution. To succeed you need to practice often, repeat the same challenges multiple times and be persistent over time.
Good luck! 🤞
Beginner
- 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
- Power
- Factorial
- Product
- Capitalize first
- Decapitalize const
- Longest word
- Reverse list
Intermediate
- Is palindrome
- Is tolerant palindrome
- Is permutation palindrome
- Is anagram
- Max occurring char
- String reverse
- Find the vowels
- Int reverse
- Pyramid generator
- Steps generator
- Fizz Buzz
- Caesar cipher
- Has repeated char
- Smallest elements
- Largest elements
Advanced
- Spiral matrix generator
- Find rectangle
- Queue
- Combine queues
- Stack
- Bubble sort
- Selection sort
- Square equals
- Sum zero
- Digit frequency
- Get duplicated arguments
- Find pair with target average
- Binary search tree
- Tree traversal (breath first)
- Tree traversal (depth first)
- Tree level width
- Binary search tree (insert)
- Binary search tree (validate)
- Any callback
- Flatten
- Binary search
- Surrounded letter
- Insertion sort
- Quick sort
- Radix sort
- Doubly linked list
- Max binary heap
- Add numbers
Expert
- Chunk
- Singly linked list
- Linked list midpoint
- Circular check
- Linked list take n-th element from last
- Is sub string
- Merge sort
- Fibonacci
- Fibonacci with recursive cache
- Max sub list sum
- Min sub list length
- Subtract
- Coins
- Medan of sorted lists
- LRU Cache
- Advanced Cache
If you don't see the green play icon used to run the tests try to open Settings
> Build, Execution, Deployment
> Build tools
> Gradle
and set Gradle JVM
to a different version.
- GeeksForGeeks - large and nicely segregated set of problems.
- HackerRank - a large set of problems and additional interview problems for business.
- LeetCode - data structures/algorithms/company interview problems segregated by difficulty.
- Exercism - coding challenge website that offers MANY challenges spanning over 60 programming languages.
- Project Euler - more complex challenges, usually related to mathematics. The site already contains 600+ problems and a new code challenge is available every week or two. You will probably have to discuss the problem with the community because solutions are not on the website.
- Advent of code - one month of various programming problems released daily at the end of the year. Fortunately, archive of past events is still there.
- CoderByte - 200+ challenges, data structures/algorithms/company interview problems segregated by difficulty. Unfortunately, most of them are only available for premium users. Premium gives you access to premium step-by-step solutions and user solutions.
- CodeChef - contains a set of programming problems segregated by difficulty.
- Code Forces - list of programming challenges is smaller than other websites, but you will still have plenty of problems to solve.
- Spoj - list of programming challenges is smaller than other websites, but you will still have plenty of problems to solve.
- CodeWars - solve visual challenges by writing code for the.
- CodinGame - solve visual challenges by writing code for the.
- JavaScript Algorithms and Data Structures Masterclass
- The Coding Interview Bootcamp Algorithms + Data Structures
- Master the Coding Interview Data Structures + Algorithms
- Learning Algorithms in JavaScript from Scratch
- 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 the most popular sorting algorithms using animations.
- Big-O poster - time/space complexity poster to print and put on the wall.
- Big-O Cheat Sheet - covers the space and time Big-O complexities of common algorithms.
Feedback and new contributions are welcome whether it's through bug reports or new PRs. To add new coding challenges just follow this guide and open PR.
MIT License
Copyright (c) 2023 Igor Wojda
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.