Find all rectangles filled with 0
We have one 2D array, filled with zeros and ones. We have to find the starting point and ending point of all rectangles filled with 0. It is given that rectangles are separated and do not touch each other however they can touch the boundary of the array.A rectangle might contain only one element. In Javascript preferred.
Examples:
input = [
[1, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 0, 0, 0, 1],
[1, 0, 1, 0, 0, 0, 1],
[1, 0, 1, 1, 1, 1, 1],
[1, 0, 1, 0, 0, 0, 0],
[1, 1, 1, 0, 0, 0, 1],
[1, 1, 1, 1, 1, 1, 1]
]
Output:
[
[2, 3, 3, 5], [3, 1, 5, 1], [5, 3, 6, 5]
]
Explanation:
We have three rectangles here, starting from
(2, 3), (3, 1), (5, 3)
Input = [
[1, 0, 1, 1, 1, 1, 1],
[1, 1, 0, 1, 1, 1, 1],
[1, 1, 1, 0, 0, 0, 1],
[1, 0, 1, 0, 0, 0, 1],
[1, 0, 1, 1, 1, 1, 1],
[1, 1, 1, 0, 0, 0, 0],
[1, 1, 1, 1, 1, 1, 1],
[1, 1, 0, 1, 1, 1, 0]
]
Output:
[
[0, 1, 0, 1], [1, 2, 1, 2], [2, 3, 3, 5],
[3, 1, 4, 1], [5, 3, 5, 6], [7, 2, 7, 2],
[7, 6, 7, 6]
]In: Computer Science
QUESTION 8
In a base-case scenario, the output is determined by assuming
| a. |
worst values that can be expected for the random variables of a model. |
|
| b. |
the most likely values for the random variables of a model. |
|
| c. |
the mean trial values for the random variables of a model. |
|
| d. |
best values that can be expected for the random variables of a model. |
|
| e. |
None of the above |
1.5 points
QUESTION 9
The points where constraints intersect on the boundary of the feasible region are termed as the
| a. |
feasible points |
|
| b. |
extreme points |
|
| c. |
feasible edges |
|
| d. |
objective function contour |
|
| e. |
None of the above |
1.5 points
QUESTION 10
A set of values for the random variables is called a(n)
| a. |
permuation |
|
| b. |
combination |
|
| c. |
event |
|
| d. |
trial |
|
| e. |
None of the above |
1.5 points
QUESTION 11
Which of the following techniques belongs to predictive analytics?
| a. |
Linear regression |
|
| b. |
Decision analysis |
|
| c. |
Data visulaization |
|
| d. |
Optimization models |
|
| e. |
I do not know |
1.5 points
QUESTION 12
The purpose of regression analysis is to
| a. |
verify a statistical hypothesis concerning the unknown population parameter |
|
| b. |
check the correlation between the mean and the variance |
|
| c. |
prove the mean depends on the standard deviation |
|
| d. |
identify the relationship between a dependent variable and independent variables |
|
| e. |
I do not know |
1.5 points
QUESTION 13
The uncontrollable future events that affect the outcomes of a decision are known as
| a. |
states of nature |
|
| b. |
alternatives |
|
| c. |
payoffs |
|
| d. |
decision outcomes |
|
| e. |
I do not know |
1.5 points
QUESTION 14
A __________ uses repeated random sample to represent uncertainty in a model representing a real system and that computes the values of model outputs.
| a. |
Monte Carlo simulation |
|
| b. |
what-if analysis |
|
| c. |
deterministic model |
|
| d. |
discrete event simulation |
|
| e. |
I do not know |
In: Statistics and Probability
Stillwater Video Company, Inc. produces and markets two popular video games, High Range and Star Boundary. The closing account balances on the company's balance sheet for the last year are as follows: Cash, $18,735; Accounts Receivable, $19,900; Materials Inventory, $18,510; Work in Process Inventory, $24,680; Finished Goods Inventory, $21,940; Prepaid Expenses, $3,420; Plant and Equipment, $262,800; Accumulated Depreciation-Plant and Equipment, $55,845; Other Assets, $9,480; Accounts Payable, $52,640; Mortgage Payable, $70,000; Common Stock, $90,000; and Retained Earnings, $110,980.
Operating budgets for the first quarter of the coming year show the following estimated costs: direct materials purchases, $58,100; direct materials usage, $62,400; direct labor expense, $42,880; overhead, $51,910; selling expenses, $35,820; general and administrative expenses, $60,240; cost of goods manufactured, $163,990; and cost of goods sold, $165,440. Estimated ending cash balances are as follows: January, $34,610; February, $60,190; and March, $54,802. The company will have no capital expenditures during the quarter.
Sales are projected to be $125,200 in January, $105,100 in February, and $112,600 in March. Accounts receivable are expected to double during the quarter, and accounts payable are expected to decrease by 20 percent. Mortgage payments for the quarter will total $6,000 of which $2,000 will be interest expense. Prepaid expenses are expected to go up by $20,000, and other assets are projected to increase by 50 percent over the budgeted period. Depreciation for plant and equipment (already included in the overhead budget) averages 5 percent of total plant and equipment for the year. Federal income taxes (34 percent of profits) are payable in April. The company pays no dividends.
Required
In: Accounting
short answers
In: Civil Engineering
In this assignment we will be working with both text strings and a user input integer array from the data segment. The goal of the assignment is to have the user choose the number of items that they want to have in an array (we will keep it a small number for now, 1-10) and then enter those values which we will store into our array. We then want to allow them to search for a specific item in the list of number that they just entered and report if the number was found or not. Requirements:
• Name your program P02LastNameFirstName.asm
• You must make use of the data segment in order to both have strings to prompt the user and to have a location to store the values the user inputs.
• String prompts and information about the program must be given to the user in a well formatted and logical fashion so that someone using the program with no knowledge about it would understand what is happening.
• The user must be allowed to choose the number of items they are going to input, though we will limit it to a smaller number (1-10).
• The user can then enter their integers, which must be stored in the array defined in the data segment.
• You will then prompt the user for an integer to search for and then search through the input array to see if it is present. • If it is, report success. If it is not found, report failure.
Hints: • Remember that the data segment holds the larger pieces of data and the text segment has the instructions that will be run. • You can define an area for more data than you use. • Using “.align #” in the data segment can help if your array is not aligned on memory boundaries (an error you may encounter). The # refers to the boundary you want to align on, check the tooltip in MARS for more information. The value 2 is the likely choice. • Keep in mind that since we are working with integers, that we will need to move through our array with their size in mind.
In: Computer Science
Electromagnetics
Question B1.
(a) A generator with Vg = 300 V, and Zg = 50 Ω is connected to a load ZL =75 Ω through a 50-Ω lossless transmission line of length, l = 0.15λ. Determine the,
(i) Zin, the input impedance of the line at the generator end;
(ii) input current I i and voltage Vi ;
(iii) time-average power delivered to the line, = 0.5 x Re{V .I*};
(iv) load voltage VL, and current, IL; and
(v) the time-average power delivered to the load, = 0.5 x Re{VL .IL*};how does compare to ? Explain?
(vi) compute the time average power delivered by the generator, Pg , and the time average power dissipated in Zg . Is conservation of power satisfied?. [12 marks]
(b) A team of scientists is designing a radar as a probe for measuring the depth of the ice layer over the antarctic land mass. In order to measure a detectable echo due to the reflection by the ice-rock boundary, the thickness of the ice sheet should not exceed three skin depths. If ε' = 3 a n d ε'' = 10-2 for ice and if the maximum anticipated ice thickness in the area under exploration is 1.2 km, what frequency range is useable with the radar? [6 marks]
(c) A 0.5-MHz antenna carried by an airplane flying over the ocean surface generates a wave that approaches the water surface in the form of a normally incident plane wave with an electricfield amplitude of 3,000 (V/m). Sea water is characterized by μr = 1, εr = 72, and σ = 4 S/m. The plane is trying to communicate a message to a submarine submerged at a depth d below the water surface. The submarine’s receiver requires a minimum signal of 0.01 μV/m amplitude, what is the maximum depth d to which successful communication is still possible? [7 marks]
In: Electrical Engineering
Can someone please complete the following code(Java). The stuff in comments are the things you need to look at and code that
package mini2;
import static mini2.State.*;
/**
* Utility class containing the key algorithms for moves in the
* a yet-to-be-determined game.
*/
public class PearlUtil
{
private PearlUtil()
{
// disable instantiation
}
/**
* Replaces all PEARL states with EMPTY state between indices
* start and end, inclusive.
* @param states
* any array of States
* @param start
* starting index, inclusive
* @param end
* ending index, inclusive
*/
public static void collectPearls(State[] states, int start, int end)
{
// TODO
}
/**
* Returns the index of the rightmost movable block that is at or
* to the left of the given index start. Returns -1 if
* there is no movable block at start or to the left.
* @param states
* array of State objects
* @param start
* starting index for searching
* @return
* index of first movable block encountered when searching towards
* the left, starting from the given starting index; returns -1 if there
* is no movable block found
*/
public static int findRightmostMovableBlock(State[] states, int start)
{
// TODO
return 0;
}
/**
* Creates a state array from a string description, using the character
* representations defined by State.getValue. (For invalid
* characters, the corresponding State will be null, as determined by
* State.getValue.)
* Spaces in the given string are ignored; that is, the length of the returned
* array is the number of non-space characters in the given string.
* @param text
* given string
* @return
* State array constructed from the string
*/
public static State[] createFromString(String text)
{
// TODO
return null;
}
/**
* Determines whether the given state sequence is valid for the moveBlocks
* method. A state sequence is valid for moveBlocks if
*
*
*
*
* of the array
*
* Boundary states are defined by the method State.isBoundary, and
* are defined differently based on whether there is any movable block in the array.
* @param states
* any array of States
* @return
* true if the array is a valid state sequence, false otherwise
*/
public static boolean isValidForMoveBlocks(State[] states)
{
// TODO
return false;
}
/**
* Updates the given state sequence to be consistent with shifting the
* "player" to the right as far as possible. The starting position of the player
* is always index 0. The state sequence is assumed to be valid
* for movePlayer, which means that the sequence could have been
* obtained by applying moveBlocks to a sequence that was valid for
* moveBlocks. That is, the validity condition is the same as for moveBlocks,
* except that
*
*
*
* no movable blocks
*
*
* The player's new index, returned by the method, will be one of the following:
*
*
* first movable block in the array;
*
* the last position in the array;
*
*
* Note the last state of the array is always treated as a boundary for the
* player, even if it is OPEN_GATE or PORTAL.
* All pearls in the sequence are changed to EMPTY and any open gates passed
* by the player are changed to CLOSED_GATE by this method. (If the player's new index
* is on an open gate, its state remains OPEN_GATE.)
* @param states
* a valid state sequence
* @return
* the player's new index
*/
public static int movePlayer(State[] states)
{
// TODO
return 0;
}
/**
* Updates the given state sequence to be consistent with shifting all movable
* blocks as far to the right as possible, replacing their previous positions
* with EMPTY. Adjacent movable blocks
* with opposite parity are "merged" from the right and removed. The
* given array is assumed to be valid for moveBlocks in the sense of
* the method validForMoveBlocks. If a movable block moves over a pearl
* (whether or not the block is subsequently removed
* due to merging with an adjacent block) then the pearl is also replaced with EMPTY.
*
* Note that merging is logically done from the right.
* For example, given a cell sequence represented by ".+-+#", the resulting cell sequence
* would be "...+#", where indices 2 and 3 as move to index 3 and disappear
* and position 1 is moved to index 3.
* @param states
* a valid state sequence
*/
public static void moveBlocks(State[] states)
{
// TODO
}
}
Here's the class where you can check your code
package mini2;
/**
* Possible cell states for a certain puzzle game.
*/
public enum State
{
// WARNING: if we change these, be sure to update the TEXT array
too!
EMPTY,
WALL,
PEARL,
OPEN_GATE,
CLOSED_GATE,
MOVABLE_POS,
MOVABLE_NEG,
SPIKES_LEFT,
SPIKES_RIGHT,
SPIKES_DOWN,
SPIKES_UP,
SPIKES_ALL,
PORTAL;
public static boolean isMovable(State s)
{
return s == MOVABLE_POS || s == MOVABLE_NEG;
}
public static boolean canMerge(State s1, State s2)
{
return s1 == MOVABLE_POS && s2 == MOVABLE_NEG ||
s2 == MOVABLE_POS && s1 == MOVABLE_NEG;
}
public static boolean isBoundary(State s, boolean
containsMovable)
{
if (!containsMovable)
{
return s == CLOSED_GATE ||
s == SPIKES_LEFT ||
s == SPIKES_RIGHT ||
s == SPIKES_DOWN ||
s == SPIKES_UP ||
s == SPIKES_ALL ||
s == WALL;
}
else
{
return s == CLOSED_GATE ||
s == SPIKES_LEFT ||
s == SPIKES_RIGHT ||
s == SPIKES_DOWN ||
s == SPIKES_UP ||
s == SPIKES_ALL ||
s == WALL ||
s == OPEN_GATE ||
s == PORTAL;
}
}
public static final char[] TEXT = {
'.', // EMPTY,
'#', // WALL,
'@', // PEARL,
'o', // OPEN_GATE,
'x', // CLOSED_GATE,
'+', // MOVABLE_POS,
'-', // MOVABLE_NEG,
'<', // SPIKES_LEFT,
'>', // SPIKES_RIGHT,
'v', // SPIKES_DOWN,
'^', // SPIKES_UP,
'*', // SPIKES_ALL,
'O'// PORTAL;
};
public static final char NULL_CHAR = 'n';
public static char getChar(State s)
{
if (s == null)
{
return NULL_CHAR;
}
else
{
return TEXT[s.ordinal()];
}
}
public static State getValue(char c)
{
int i;
for (i = 0; i < TEXT.length; ++i)
{
if (TEXT[i] == c)
{
break;
}
}
if (i < TEXT.length)
{
return State.values()[i];
}
else if (c >= 'A' && c <= 'Z')
{
return State.PORTAL;
}
else return null;
}
public static String toString(State[] arr)
{
return toString(arr, true);
}
public static String toString(State[] arr, boolean addSpaces)
{
String text = "";
for (int col = 0; col < arr.length; ++col)
{
State s = arr[col];
char ch = getChar(s);
text += ch;
if (addSpaces && col < arr.length - 1)
{
text += " ";
}
}
return text;
}
}
In: Computer Science
C:13-57 Bonnie died on June 1, 2018, survived by her husband,
Abner, and two sons, Carl and Doug. Bonnie’s only lifetime taxable
gift was made in October 2015 in the taxable amount of $6.25
million. She did not elect gift splitting. By the time of her
death, the value of the gifted property (stock) had declined to
$5.1 million. Bonnie’s executor discovered the items shown below.
Amounts shown are the FMVs of the items as of June 1, 2018.
Cash in checking account in her name $ 199,750
Cash in savings account in her name 430,000
Stock in names of Bonnie and Doug, joint tenants with right of
survivorship. Bonnie provided all the consideration ($3,000) to
purchase the stock. 25,000
Land in names of Bonnie and Abner, joint tenants with right of
survivorship. Abner provided all the consideration to purchase the
land. 360,000
Personal residence in only Bonnie’s name 450,000
Life insurance on Bonnie’s life. Bonnie was owner, and Bonnie’s
estate was beneficiary (face value) 5,000,000
Trust created under the will of Bonnie’s mother (who died in
2000).
Bonnie was entitled to all the trust income for life, and she could
will the trust property to whomever she desired. She willed it to
her sons in equal amounts. 9,000,000
Bonnie’s debts, as of her date of death, were $60,000. Her funeral
and administration expenses were $9,000 and $71,000, respectively.
Her estate paid state death taxes of $65,000.
The executor elected to deduct the administration expenses on the
estate tax return.
Bonnie’s will included the following:
I leave my residence to my husband Abner.
$250,000 of property is to be transferred to a trust with First
Bank named as trustee. All of the income is to be paid to my
husband, Abner, semiannually for the rest of his life. Upon his
death the property is to be divided equally between my two sons or
their estates. I leave $47,000 to the American Cancer
Society.
Assume the executor elected to claim the maximum marital deduction
possible. Compute the following with respect to Bonnie’s
estate:
a. Gross estate
b. Taxable estate
c. Adjusted taxable gifts
d. Estate tax base and basic exclusion amount portable to
Abner
e. Tentative tax on estate tax base
f. Federal estate tax payable
Use the limits for 2019. The Tax Cuts and Jobs Act of 2017 increased the unified credit to $4,417,800, the tax on a basic exclusion amount of $11.18 million.
In: Accounting
Instructions: Each of the following scenarios illustrates one of
Freud’s defense mechanisms from the list below. Read each case,
identify the defense mechanism, and explain how it is illustrated
by the example.
Displacement
Regression
projection
Repression
Rationalization
Sublimation
Reaction Formation
Denial
1. After losing the soccer game by failing to stop a goal, Hester
explains to her older brother, “Winning is really quite meaningless
and unimportant. It has little to do with true happiness.” What
defense is Hester using?
2. Angela really likes her older sister’s boyfriend and wants him
to ask her out despite the fact that he only has eyes for her older
sister. On a conscious level, she knows her feelings are
unacceptable, so she turns it around. Angela tells her best friend,
“I think Roberto dates my sister to be nearer to me.” What defense
is Angela using?
3. Jack is in love with his teacher but feels guilty about it. In
class, he acts like a horrible, disrespectful brat. What defense is
Jack using?
4. Secretly, Amanda likes reading sexually explicit materials but
she struggles because she feels it is morally wrong. She takes a
job at the local library screening books for obscenity in order to
protect the public. What defense is Amanda using?
5. Serika notices that her 7-year-old son likes to pull wings off
flies, jab pins in the cat, and trap mice so he can cut off their
tails. Serika tells herself that her son has a great future in
medicine. What defense is Serika using?
6. Eric received a “fair” grade on a paper he worked very hard to
complete and was quite proud of. After school, he picks a fight
with his sister, calls her a jerk, and tells her she’s “stupid.”
What defense is Eric using?
7. Emmanuel’s mother has been very busy taking on extra projects a
t work. She frequently works late or brings the projects home to
complete at night. Despite the fact that he is 8-years-old,
Emmanuel has bee sucking his thumb and wetting the bed. What
defense is Emmanuel using?
8. Georgia was extremely close to her grandfather. He died
unexpectedly last year and though Georgia attended all the funeral
services, she does not remember any of events that took place for
those three days. What defense is Georgia using?
In: Psychology
Case Study No. 1
Sue Kim, 49 years of age, emigrated from South Korea to the
United States 6 years ago. Her family came to the US to
educate their children and moved in with family members in
Los Angeles. Sue and her husband graduated from a top-ranked
university
in South Korea, and her husband also had a master’s degree in
business. However, their English skills were not adequate for
them to get jobs in the United States. Instead, they opened a
Korean grocery store with the money they brought from South
Korea, and they managed to settle down in Los Angeles, where a
number of Koreans are living. They have two children: Mina, a
25-year-old daughter who is
now the manager of a local shop, and Yujun, a 21-year-old
son who is a college student. Both children were born in
South
Korea and moved to United States with Sue. The children had
a hard time, especially Mina, who came to the United States
in
her senior year of high school. However, the children finally
adapted to their new environment. Now, Mina is living alone
in one-bedroom apartment near downtown, and Yujun is
living in a university dormitory. The Kim’s are a religious family
and attend their community’s
protestant church regularly. They are involved in many church
activities. Sue and her husband have been too busy to have
regular annual checkups for the past 6 years. About 1 year ago, Sue
began to have serious indigestion, nausea, vomiting, and upper
abdominal pain; she took some
over-the-counter medicine and tried to tolerate the pain.
Last
month, her symptoms became more serious; she visited a local
clinic and was referred to a larger hospital. Recently, she
was
diagnosed with stomach cancer after a series of diagnostics
tests and had surgery; she is now is undergoing chemotherapy. You
are the nurse who is taking care of Sue during this
hospitalization. Sue is very polite and modest whenever you
approach her. Sue is very quiet and never complains about any
symptoms or pain. However, on several occasions, you think
that Sue is in serious pain, when considering her facial
expressions and sweating forehead. You think that Sue’s
English skills may not allow her to adequately communicate
with health care providers. Also, you find that Sue does not
have many visitors -only her husband and two children.
NCM 100 TFN – Case Study 1 Topic: Transitions Theory by Afaf
Ibrahim Meleis
You frequently find Sue praying while listening to some
previous songs. You also find her sobbing silently. About 2
weeks are left until Sue finishes chemotherapy. You think
that
you should do something for Sue so she will not suffer
through pain and symptoms that could be easily controlled
with existing pain-management strategies. Now, you begin
some preliminary planning. Answer the following Questions:
1. Describe your assessment of the transition(s) Sue is
experiencing. What are the types and patterns of
transition(s)?
What properties of transitions can you identify from her
case?
2. What personal, community, and societal transition
conditions may have influenced Sue’s experience? What are
the cultural meanings attached to cancer, cancer pain, and
symptoms accompanying chemotherapy, in this situation?
What are Sue’s cultural attitudes toward cancer and cancer
patient’s? What factors may facilitate or inhibit her
transition(s)?
3. Consider the patterns of response that Sue is showing.
What
are the indicators of healthy transition(s)? What are the
indicators of unhealthy transition(s)?
4. Reflect on how Transitions Theory helped your assessment
and nursing care for Sue. 5. If you were Sue’s nurse, what would be
your first
action/interaction with her? Describe a plan of nursing care
for
Sue.
In: Nursing