Easy checking queen can attack or not with row col and diagonal check
Intuition\n Describe your first thoughts on how to solve this problem. \nFirstly understand the problem the queen can attack the king if thereb is no queen obst
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nFirstly understand the problem the queen can attack the king if thereb is no queen obstacle and the king is row or col or diagonal to king so the king can attack\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nTake a matrix of 8*8 and fill -1 at all indices then fill 1 in king position then fill 0 with each queen then take nested loops to find the queen if queen is founded then check can it able to attack the king with no obstacles of queens\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->O(n*2)\n\n- Space complexity:\n# <!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public List<List<Integer>> queensAttacktheKing(int[][] queens, int[] king) {\n        List<List<Integer>> al=new ArrayList<>();\n\n       int nums[][]=new int[8][8];\n       for(int i=0;i<8;i++)\n       {\n           for(int j=0;j<8;j++)\n           {\n               nums[i][j]=-1;\n           }\n       }\n       nums[king[0]][king[1]]=1;\n       int c=0;\n       for(int i=0;i<queens.length;i++)\n       {\n           nums[queens[i][0]][queens[i][1]]=0;\n       }\n       for(int i=0;i<nums.length;i++)\n       {\n           \n           for(int j=0;j<nums.length;j++)\n           {\n               if(nums[i][j]==0)\n               if(check(nums,i,j)==1)\n               {\n                   ArrayList<Integer> t=new ArrayList<Integer>();\n                   c++;\n                   t.add(i);\n                   t.add(j);\n                   al.add(t);\n               }\n           }\n           \n       }\n       return al;\n        \n    }\n    public int check(int nums[][],int r,int c)\n    {\n        int x=0;\n        for(int i=c+1;i<nums.length;i++)\n        {\n            if(nums[r][i]==1)\n            {\n                return 1;\n            }\n            if(nums[r][i]==0)\n            {\n               break;\n            }\n        }\n        for(int i=c-1;i>=0;i--)\n        {\n            if(nums[r][i]==1)\n            {\n                return 1;\n            }\n            if(nums[r][i]==0)\n            {\n               break;\n            }\n        }\n        for(int i=r+1;i<nums.length;i++)\n        {\n            if(nums[i][c]==1)\n            {\n                return 1;\n            }\n            if(nums[i][c]==0)\n            {\n               break;\n            }\n        }\n        for(int i=r-1;i>=0;i--)\n        {\n            if(nums[i][c]==1)\n            {\n                return 1;\n            }\n            if(nums[i][c]==0)\n            {\n               break;\n            }\n        }\n        for(int i=r-1,j=c-1;i>=0&&j>=0;i--,j--)\n        {\n            if(nums[i][j]==1)\n            {\n                return 1;\n            }\n            if(nums[i][j]==0)\n            {\n               break;\n            }\n        }\n        for(int i=r+1,j=c+1;i<nums.length&&j<nums.length;i++,j++)\n        {\n            if(nums[i][j]==1)\n            {\n                return 1;\n            }\n            if(nums[i][j]==0)\n            {\n               break;\n            }\n        }\n        for(int i=r+1,j=c-1;i<nums.length&&j>=0;i++,j--)\n        {\n            if(nums[i][j]==1)\n            {\n                return 1;\n            }\n            if(nums[i][j]==0)\n            {\n               break;\n            }\n        }\n        for(int i=r-1,j=c+1;i>=0&&j<nums.length;i--,j++)\n        {\n            if(nums[i][j]==1)\n            {\n                return 1;\n            }\n            if(nums[i][j]==0)\n            {\n               break;\n            }\n        }\n        return 0;\n    }\n}\n```
['Array', 'Java']