subject

##PYTHON##spiral_matrix(rows: int, cols: int, start: int) -> StaticArray: NO Python built-in functions. Only use the pre-defined StaticArray class and Methods.
Write a function that receives three integers (rows, cols, and start), then creates and returns a 2D matrix (represented as a StaticArray of StaticArrays). The dimensions of the matrix should be rows x cols. The matrix should be filled with the integers that start from the provided start value and sequentially increase by 1 (if the start value is >= 0) or decrease by 1 (if the start value is < 0).
When the start value is non-negative, it should be placed in the upper right corner of the matrix, and all subsequent integers should be put into the matrix in a clockwise spiral order. See figure 1 below for more details. When the start value is negative, it should be placed in the lower left corner of the matrix, and all subsequent integers should be put into the matrix in a counterclockwise spiral order. See figure 2 below for more details.
Please review the code examples below, (especially example #2) for clarification. You may assume that rows and cols will be positive integers. You do not need to write checks for these conditions.

ansver
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 06:30, Nicki3729
Exchanging which type of data uses the least bandwidth? music photographs video voice bandwidth- the amount of data that can be moved between two points in a set time period
Answers: 1
image
Computers and Technology, 23.06.2019 07:30, cireland
Write a program that inserts the digits of an integer into an array in originalorderfollowed by reverse order. first, promptthe user to enter a positive integer(> 0). determine the number of digits of the integer. create a dynamically allocated integer arrayof a size twice the number of digits. now insert the digits in original order which will occupy half of the array. then, insert the digits in reverse order. finally, output thedigits in thearray. use at least two functions to organize your program.
Answers: 3
image
Computers and Technology, 24.06.2019 03:30, etxchrissy
What is the purpose of a computer network needs assessment? to analyze which workers need more training to improve their performance to compare worker productivity to determine what steps employees can take to increase company revenue to evaluate how to move from the current status to the desired goal
Answers: 2
image
Computers and Technology, 24.06.2019 10:00, lashaunahard
Each time you save a document, you will need to type in the file type in which it should be saved you can select the save button to save it with the same file name if it has been previously saved you will need to select the location to save the file you will need to use the save as dialog box
Answers: 1
You know the right answer?
##PYTHON##spiral_matrix(rows: int, cols: int, start: int) -> StaticArray: NO Python built-in fun...

Questions in other subjects:

Konu
Mathematics, 20.10.2020 02:01