Queen's Attack II Discussions | Algorithms | HackerRank

Sort by

recency

|

1015 Discussions

|

  • + 0 comments

    Here is Queen's attack ii problem solution in python, java, c++, c and javascript programming - https://programmingoneonone.com/hackerrank-queens-attack-ii-problem-solution.html

  • + 0 comments

    java solution

    class Result {
        private static final int[][] queenDirections = {{0, 1}, {1, 1}, {1, 0}, {1, -1}, {0, -1}, {-1, -1}, {-1, 0}, {-1, 1}};
    
        public static int queensAttack(int n, int k, int r_q, int c_q, List<List<Integer>> obstacles) {
            Set<List<Integer>> obstaclesSet = new HashSet<>();
            for (List<Integer> obstacle : obstacles) {
                obstaclesSet.add(obstacle);
            }
            int attackableSquares = -8;
            for (int[] queenDirection : queenDirections) {
                int r = r_q;
                int c = c_q;
                List<Integer> checkedPosition = List.of(r, c);
                while (r <= n && c <= n && r >= 1 && c >= 1 && !obstaclesSet.contains(checkedPosition)) {
                    r += queenDirection[0];
                    c += queenDirection[1];
                    checkedPosition = List.of(Integer.valueOf(r), Integer.valueOf(c));
                    attackableSquares++;
                }
            }
            return attackableSquares;
        }
    }
    
  • + 0 comments

    Good challenge. Also, I found this tool that gives a very detailed analysis of my resume and suggests amazing improvements: www.autointerviewai.com/ats-score . You guys might wanna check it out!

  • + 0 comments

    Given plenty of time, I can complete medium diffcult level problem with lip fillers yaletown. but I cannot complate in half an hour.

  • + 0 comments

    If you’re looking for a great investment or a new home, there are some interesting options available. I recently came across an apartment for sale in Thessaloniki that caught my attention due to its central location and modern amenities. The neighborhood is vibrant, with easy access to shops, cafes, and public transport. Pricing seems reasonable compared to similar properties in the area. I’m curious if anyone has experience buying in Thessaloniki and can share tips on the process or reliable real estate agents. Any advice would be really appreciated!