Garmaine Staff asked 1 year ago
Closed. This question needs to be more focused. It is not currently accepting answers.

Want to improve this question? Update the question so it focuses on one problem only by editing this post.

Closed 10 hours ago.

Amazon programming questionKindly provide solutions in C++ . when i run found many errors. class updateServer { int minDays(int row, int columns, int grid[][]) { int serverWithoutFiles =0; int queue1 = Queue<(int,int)> (grid, rows, columns, serverWithoutFiles); int minimumDays = 0; while (queue1.count < 0 && serverWithoutFiles < 0) { int qcount = queue1.count; for (int i =0; i private void processNeighbours(Queue<(int,int)> queue, int [][] grid, int rows, int columns, int serverWithoutFiles) { (int x, int y) = queue.Dequeue(); if (x > 0 && grid[x-1][y] == 0) { grid[x-1][y] = 1; serverWithoutFiles–; queue.Enqueue((x-1, y)); } if (x+1 < rows && grid[x+1][y] == 0) { grid[x+1][y] == 1; serverWithoutFiles–; queue.Enqueue((x+1, y)); } if (y > 0 && grid[x][y-1] == 0) { grid[x][y-1] == 1; serverWithoutFiles–; queue.Enqueue((x, y-1)); } if (y+1 < columns && grid[x][y+1] == 0) { grid[x][y+1] = 1; serverWithoutFiles–; queue.Enqueue((x, y+1)); } } queue1 :: Queue<(int, int)> (grid, rows, columns, int serverWithoutFiles) { serverWithoutFiles = 0; Queue<(int, int)> q = new Queue<(int, int)>(); for (int x = 0; x < rows; x++) { for (int y = 0; y < columns; y++) { if (grid[x][y] == 0) { serverWithoutFiles++; } else { q.Enqueue((x,y)); } } } return q; } }