Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nmicht/algorithm-exercises
Practicing algorithm exercises
https://github.com/nmicht/algorithm-exercises
algorithm-challenges algorithm-competitions algorithms algorithms-implemented hackerrank-solutions interviewbit-solutions leetcode-solutions
Last synced: 7 days ago
JSON representation
Practicing algorithm exercises
- Host: GitHub
- URL: https://github.com/nmicht/algorithm-exercises
- Owner: nmicht
- Created: 2018-11-21T04:38:36.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-09-27T02:02:47.000Z (about 4 years ago)
- Last Synced: 2024-10-27T16:51:42.913Z (about 2 months ago)
- Topics: algorithm-challenges, algorithm-competitions, algorithms, algorithms-implemented, hackerrank-solutions, interviewbit-solutions, leetcode-solutions
- Language: Python
- Homepage:
- Size: 279 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Algorithm Exercises
Repository to save all the algorithms that I solved to practice algorithms, but also all the others that I was not able to complete during my time window for this.
## Algorithm Lessons learned
- [Boyer-Moore algorithm](https://en.m.wikipedia.org/wiki/Boyer%E2%80%93Moore_majority_vote_algorithm) to get the majority
- [Bit xor](https://hackernoon.com/xor-the-magical-bit-wise-operator-24d3012ed821) to cancel same numbers
- Most significant bit
- [Dynamic programming](https://en.wikipedia.org/wiki/Dynamic_programming)
- Sort before doing things## Language lessons learned
- JavaScript sort is made for strings, for numbers is required to do a subtraction
- Python: avoid pop and try to access directly to the element, that improves performance a lot
- Python: for-in does not include "end"
- Python: can use lambdas to order by object key `myList.sort(key=lambda obj: obj.prop, reverse=False)`
- Python: for range if the step is not one by one, you have to add it as a third parameter `range(5, 1, -1)`