Rotating a 2D Array by 90 Degrees - In Place (Java)
A 2-dimensional array is an array of arrays.Implement a function that takes a square 2D array (# columns = # rows) and rotates it by 90 degrees.Example: [[1, 2, 3], [4, 5, 6], [7, 8, 9]]->[[7, 4, 1], [8, 5, 2], [9, 6, 3]]When you are done, try implementing this function so that you can solve this problem in place. Solving it in place means that your function won't create a new array to solve thi..
더보기
Rotating a 2D Array by 90 Degrees (Java)
A 2-dimensional array is an array of arrays.Implement a function that takes a square 2D array (# columns = # rows) and rotates it by 90 degrees.Example: [[1, 2, 3], [4, 5, 6], [7, 8, 9]]->[[7, 4, 1], [8, 5, 2], [9, 6, 3]]When you are done, try implementing this function so that you can solve this problem in place. Solving it in place means that your function won't create a new array to solve thi..
더보기
Find Where to Expand in Minesweeper (Java)
Implement a function that turns revealed cells into -2 given a location the user wants to click.For simplicity, only reveal cells that have 0 in them. If the user clicks on any other type of cell (for example, -1 / bomb or 1, 2, or 3), just ignore the click and return the original field. If a user clicks 0, reveal all other 0's that are connected to it.Example 1: Given field: [[0, 0, 0, 0, 0], [..
더보기
Assign Numbers in Minesweeper (Java)
Implement a function that assigns correct numbers in a field of Minesweeper, which is represented as a 2 dimensional array.Example: The size of the field is 3x4, and there are bombs at the positions [0, 0] (row index = 0, column index = 0) and [0, 1] (row index = 0, column index = 1).Then, the resulting field should be:[[-1, -1, 1, 0], [2, 2, 1, 0], [0, 0, 0, 0]] Your function should return the ..
더보기