We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Queen's Attack II
Queen's Attack II
Sort by
recency
|
1003 Discussions
|
Please Login in order to post a comment
Here is problem solution in Python, Java, C++, C and Javascript - https://programmingoneonone.com/hackerrank-queens-attack-ii-problem-solution.html
**simple python solution **
def queensAttack(n, k, r_q, c_q, obstacles):
My Java solution with linear time and o(k) space complexity:
int queensAttack(int n, int k, int r_q, int c_q, vector> obstacles) {
}
Hint 1- Just check all obstacles that they are on one of four lines. Then you will have at maximun eight obstacles. Hint 2 - then just calculate distance to obstacle or edge of the board.