In this repository, I store my solutioins to the common programming problems. Currently, I try to implement each solution in Python and Java, maybe sometimes C++. By doing so, I can compare languages with respect to implementations.
The solutions in this repo are not meant to be the best ones. You may find better solutions out there. What is more, you can come up with your own solution which can be considered as the best one. Bear in mind that in practice optimal solution depends on various parameters such as workset data, environment, constraints etc.
Challenge | Description | Python | Java | C++ |
---|---|---|---|---|
Determine if a string contains unique characters | Challenge | Solution | Solution | - |
Determine if a string is a permutation of another | Challenge | Solution | Solution | - |
Determine if a string is a rotation of another | Challenge | - | Solution | - |
Compress a string | Challenge | Solution | Solution | - |
Reverse strings in a string | Challenge | Solution | Solution | - |
Find the first non-repeated character in a string | - | Solution | Solution | - |
Challenge | Description | Python | Java | C++ |
---|---|---|---|---|
Implement a sorted linked list | - | - | - | Solution |
Remove duplicates from a linked list | Challenge | - | - | Solution |
Find the kth to last element of a linked list | Challenge | - | - | Solution |
Delete a node in the middle of a linked list | Challenge | - | - | - |
Partition a linked list around a given value | Challenge | - | - | - |
Add two numbers whose digits are stored in a linked list | Challenge | - | - | - |
Find the start of a linked list loop | Challenge | - | - | - |
Determine if a linked list is a palindrome | Challenge | - | - | - |
Implement a linked list | Challenge | - | - | - |
Determine if a list is cyclic or acyclic | Contribute | - | - | - |
Challenge | Description | Python | Java | C++ |
---|---|---|---|---|
Implement a stack using a linked list | - | - | Solution | - |
Implement a stack using a fixed array | - | - | Solution | - |
Implement a stack using a resizable array | - | - | Solution | - |
Implement a queue using a linked list | - | - | Solution | - |
Implement a queue using a fixed array | - | - | Solution | - |
Implement a queue using a resizable array | - | - | Solution | - |
Challenge | Description | Python | Java | C++ |
---|---|---|---|---|
Implement an insertion sorting . | - | - | Solution | - |
Implement a selection sorting . | - | - | Solution | - |
Implement a shell sorting . | - | - | Solution | - |
Challenge | Description | Python | Java | C++ |
---|---|---|---|---|
Given an array A of integers, find any 3 of them that sum to 0. | Definition | - | Solution | - |
Implement Union-Find algorithm | Definition | - | Solution | - |
Challenge | Description | Python | Java | C++ |
---|---|---|---|---|
Implement depth-first search (pre-, in-, post-order) on a tree | Challenge | - | Solution | - |
Implement breadth-first search on a tree | Challenge | - | Solution | - |
Determine the height of a tree | Challenge | - | - | - |
Create a binary search tree with minimal height from a sorted array | Challenge | - | - | - |
Find diameter length and nodes of a binary tree | - | - | Solution | - |
Create a linked list for each level of a binary tree | Challenge | - | - | - |
Check if a binary tree is balanced | Challenge | - | - | - |
Determine if a tree is a valid binary search tree | Challenge | - | - | - |
Find the in-order successor of a given node in a binary search tree. | Challenge | - | - | - |
Implement a binary search tree | Challenge | - | - | - |
Implement depth-first search on a graph | Challenge | - | - | - |
Implement breadth-first search on a graph | Challenge | - | - | - |
Determine if there is a path between two nodes in a graph | Challenge | - | - | - |
Implement a graph | Challenge | - | - | - |
Print a tree using pre-order traversal without recursion | Contribute | - | - | - |
Determine the lowest common ancestor of two nodes | Contribute | - | - | - |
Transform a binary tree into a heap | Contribute | - | - | - |
Implement a right and left rotation on a tree | Contribute | - | - | - |
Check if a binary tree is binary search tree | Contribute | - | - | - |
Add a challenge | Contribute | - | - | - |
https://www.hackerrank.com/domains/tutorials/10-days-of-statistics
Challenge | Description | Python | Java | C++ |
---|---|---|---|---|
Day 4: Binomial Distribution I | Definition | Solution | - | - |
Day 4: Binomial Distribution II | Definition | Solution | - | - |
Day 4: Geometric Distribution I | Definition | Solution | - | - |
Day 5: Poisson Distribution I | Definition | Solution | - | - |
Day 5: Poisson Distribution II | Definition | Solution | - | - |
Day 5: Normal Distribution I | Definition | Solution | - | - |
Day 5: Normal Distribution II | Definition | Solution | - | - |
https://www.hackerrank.com/challenges/
Challenge | Description | Python | Java | C++ |
---|---|---|---|---|
Designer PDF Viewer | Definition | Solution | Solution | - |
https://github.com/donnemartin/interactive-coding-challenges
Code reviews and comments, even new challenges are very welcomed :)