Skip to content

Latest commit

 

History

History
9 lines (5 loc) · 588 Bytes

README.md

File metadata and controls

9 lines (5 loc) · 588 Bytes

algorithms

Majority Vote Algorithm

https://en.wikipedia.org/wiki/Boyer%E2%80%93Moore_majority_vote_algorithm

Unefficient Knight

Imagine that you have chess board and your knight is going in unregular way. One cell forward and one step right or left(instead of two cells forward and one right or left). You asked to write a function that recieves two cells and returns minimal number of steps requiered for knight to go from source cell to destination cell. If destination cell is unreachable it returns -1. Hovewer if it takes more than 20000 steps to reach the point it returns -2.