I have an NxM grid there are two chess pieces one is 'Knight' and another is 'Bishop' which has different moving abilities. As we all know 'Knight' can move 2.5 steps and a 'Bishop' can move only diagonal but not horizontally or vertically. Some grids are inactive(Occupied by other chess pieces). I wanted to Return 1 position where the knight and bishop can attack.
For example: We have an 8*8 grid. 0,3 & 2,0 are inactive grids(I mean occupied by other pieces). 'Bishop' is at 3,2 position and possible direction are represented as arrow and 'Knight' is available at 6,6 and possible direction where knight can move are represented as arrow and circles. One of the possible point where the Bishop and Knight can meet is 4,5 as represented by yellow color. The reference image is attached.
9 freelancer chào giá trung bình₹1172 cho công việc này
Hi there! I am an experienced C/C++/Python/Java programmer and an expert in data structures and algorithms. I believe i can help you and deliver your project at the earliest. Message me so that we can proceed further.
I am a competitive programmer (proficient in C++) with good problem solving skills (currently, a 6 star, 2248 rated on CodeChef, ranked 933 worldwide).
I have been a competitive programmer (CodeChef and HackerRank) and I am pretty much sure that I have solved this problem earlier, I can tell you the solution in C++.