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.
- Boyer-Moore algorithm to get the majority
- Bit xor to cancel same numbers
- Most significant bit
- Dynamic programming
- Sort before doing things
- 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)