logo Use CA10RAM to get 10%* Discount.
Order Nowlogo
(5/5)

You must rotate a square matrix counter-clockwise or clockwise 90 degrees an arbitrary number of times. You will be given a matrix of integers that has equal height and width.

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

Rotate Matrix

You must rotate a square matrix counter-clockwise or clockwise 90 degrees an arbitrary number of times. You will be given a matrix of integers (otherwise known as a 2-dimensional array), that has equal height and width. The dimension can range from 2x2 - 10x10. You will also be given an integer that may range from -100 to 100, this integer will indicate which direction to rotate the matrix and how many times to rotate it. You are expected to return the rotated matrix.

direction - The number of rotations in a particular direction. If > 0 rotate the specified amount of times clockwise. else if < 0 rotate the specified amount of times counterclockwise. Otherwise, no rotations are expected.

matrix - A two-dimensional array of integers that is to be rotated.

returns -  The rotated matrix it was initially given.

int[][] rotateMatix(int direction, int[][] matrix)

 

Remove Nested Statements

When given a string, your job is to remove a substring that starts with a prefix and ends with a suffix pattern. The patterns may be nested within each other so you must remove the outer most pattern's found in the text. The length of the prefix and suffix will always match.

 

Example:

prefix = "{" suffix = "}" text ="{Hello} Bob"

expected output = " Bob"

prefix = "{" suffix = "}" text ="He{ll}o} Bob"

expected output = "Heo} Bob"

prefix = "{" suffix = "}" text ="H{e{ll}o} Bob"

expected output = "H Bob"

text - The string with the substring to be removed

prefix - A pattern that the substring must start with

suffix -  A pattern that the substring must end with

returns -  The given text with the substring removed

String removeNestedStatements(String text, String prefix, String suffix)

Count Occurrences

Count the number of times a given pattern is found in the string in the array of strings.

Example:

array = ["aba", "ckel",  "kealska"]

pattern = "a"

output = 4

array - An array of strings

pattern - A pattern you are attempting to find in the strings contained in the array

returns - The number of times the pattern is found in the strings in the array.

int countOccurances(String[] array, String pattern)

Merger and Remove

Given two arrays of integers. Your job is to combine them into a single array and remove any duplicates, finally return the merged array.

Example:

array_1 = [1,2,3]

array_2 = [2,3,4]

output = [1,2,3,4]

array_1 - An array of integers

array_2 - An array of integers

returns - An array of integers containing the unique values from both array_1 and array_2

int[] mergeAndRemove(int[] array_1, int[] array_2)

Morse Translator

You will be given a string in either morse code or normal English text. Your job is to translate the string to the opposite language. In other words, if the string you are given is English translate the string to morse code. Furthermore, if the string is morse code translate the string into English. To keep things simple, any English text you receive will not contain any "." or "-". Please refer to this link to find the character translations.

Example:

input = "Hello"

output = ".... . .-.. .-.. ---"

input = ".... . .-.. .-.. ---"

output = "Hello"

input - A string that may be either morse code or plain English.

returns - The input converted into the opposite language of its initial format.

String morseTranslator(String text)

(5/5)
Attachments:

Related Questions

. Introgramming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C

DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma

. The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an

Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t

. Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual

Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th

. SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

. Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Um e HaniScience

843 Answers

Hire Me
expert
Muhammad Ali HaiderFinance

645 Answers

Hire Me
expert
Husnain SaeedComputer science

864 Answers

Hire Me
expert
Atharva PatilComputer science

829 Answers

Hire Me