Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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)`