diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/averages-pythagorean-means.english.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/averages-pythagorean-means.english.md index 521f1fb0a1..aeabbdb741 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/averages-pythagorean-means.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/averages-pythagorean-means.english.md @@ -9,12 +9,12 @@ challengeType: 5 Compute all three of the Pythagorean means of the set of integers 1 through 10 (inclusive). Show that $A(x_1,\ldots,x_n) \geq G(x_1,\ldots,x_n) \geq H(x_1,\ldots,x_n)$ for this set of positive integers. Assume the input is an ordered array of all inclusive numbers. For the answer, please output an object in the following format: diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/averages-root-mean-square.english.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/averages-root-mean-square.english.md index e94826d920..e2d0099a2c 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/averages-root-mean-square.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/averages-root-mean-square.english.md @@ -6,9 +6,10 @@ challengeType: 5 ## Description
-

Compute the Root mean square of the numbers 1 through 10 inclusive.

-

The root mean square is also known by its initials RMS (or rms), and as the quadratic mean.

The RMS is calculated as the mean of the squares of the numbers, square-rooted:

-

$$x_{\mathrm{rms}} = \sqrt {{{x_1}^2 + {x_2}^2 + \cdots + {x_n}^2} \over n}. $$

+Compute the Root mean square of the numbers 1 through 10 inclusive. +The root mean square is also known by its initials RMS (or rms), and as the quadratic mean. +The RMS is calculated as the mean of the squares of the numbers, square-rooted: +$$x_{\mathrm{rms}} = \sqrt {{{x_1}^2 + {x_2}^2 + \cdots + {x_n}^2} \over n}. $$
## Instructions diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/babbage-problem.english.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/babbage-problem.english.md index 39535a5e07..9452a324e5 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/babbage-problem.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/babbage-problem.english.md @@ -6,12 +6,14 @@ challengeType: 5 ## Description
-

Charles Babbage, looking ahead to the sorts of problems his Analytical Engine would be able to solve, gave this example:

-
What is the smallest positive integer whose square ends in the digits 269,696?
-

- Babbage, letter to Lord Bowden, 1837; see Hollingdale and Tootill, Electronic Computers, second edition, 1970, p. 125.

-

He thought the answer might be 99,736, whose square is 9,947,269,696; but he couldn't be certain.

-

The task is to find out if Babbage had the right answer.

-

Implement a function to return the lowest integer that satisfies the Babbage problem. If Babbage was right, return Babbage's number.

+Charles Babbage, looking ahead to the sorts of problems his Analytical Engine would be able to solve, gave this example: +
+ What is the smallest positive integer whose square ends in the digits 269,696? + +
+He thought the answer might be 99,736, whose square is 9,947,269,696; but he couldn't be certain. +The task is to find out if Babbage had the right answer. +Implement a function to return the lowest integer that satisfies the Babbage problem. If Babbage was right, return Babbage's number.
## Instructions diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/balanced-brackets.english.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/balanced-brackets.english.md index b904a4fa61..4fc4a01be7 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/balanced-brackets.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/balanced-brackets.english.md @@ -6,15 +6,17 @@ challengeType: 5 ## Description
-

Determine whether a generated string of brackets is balanced; that is, whether it consists entirely of pairs of opening/closing brackets (in that order), none of which mis-nest.

+Determine whether a generated string of brackets is balanced; that is, whether it consists entirely of pairs of opening/closing brackets (in that order), none of which mis-nest. Examples: -

(empty) true

-

[] true

-

][ false

-

[][] true

-

][][ false

-

[]][[] false

-

[[[[]]]] true

+
+(empty) true
+[] true
+][ false
+[][] true
+][][ false
+[]][[] false
+[[[[]]]] true
+
## Instructions diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/circles-of-given-radius-through-two-points.english.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/circles-of-given-radius-through-two-points.english.md index ac44b0e989..51f7e741fd 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/circles-of-given-radius-through-two-points.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/circles-of-given-radius-through-two-points.english.md @@ -6,18 +6,23 @@ challengeType: 5 ## Description
-

Given two points on a plane and a radius, usually two circles of given radius can be drawn through the points.

-Exceptions: -A radius of zero should be treated as never describing circles (except in the case where the points are coincident). -If the points are coincident then an infinite number of circles with the point on their circumference can be drawn, unless the radius is equal to zero as well which then collapses the circles to a point. -If the points form a diameter then return a single circle. -If the points are too far apart then no circles can be drawn.Task: +Given two points on a plane and a radius, usually two circles of given radius can be drawn through the points. +Exceptions: + +Task: Implement a function that takes two points and a radius and returns the two circles through those points. For each resulting circle, provide the coordinates for the center of each circle rounded to four decimal digits. Return each coordinate as an array, and coordinates as an array of arrays. -For edge cases, return the following: -If points are on the diameter, return one point. If the radius is also zero however, return "Radius Zero". -If points are coincident, return "Coincident point. Infinite solutions". -If points are farther apart than the diameter, return "No intersection. Points further apart than circle diameter". -Sample inputs: +For edge cases, return the following: + +Sample inputs:
       p1                p2           r
 0.1234, 0.9876    0.8765, 0.2345    2.0
@@ -26,7 +31,7 @@ Sample inputs:
 0.1234, 0.9876    0.8765, 0.2345    0.5
 0.1234, 0.9876    0.1234, 0.9876    0.0
 
-Ref: +Ref: Finding the Center of a Circle from 2 Points and Radius from Math forum @ Drexel
diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/closest-pair-problem.english.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/closest-pair-problem.english.md index 170e0290ac..516e62dcb8 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/closest-pair-problem.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/closest-pair-problem.english.md @@ -6,34 +6,34 @@ challengeType: 5 ## Description
-Task: -

Provide a function to find the closest two points among a set of given points in two dimensions, i.e. to solve the Closest pair of points problem in the planar case.

The straightforward solution is a O(n2) algorithm (which we can call brute-force algorithm); the pseudo-code (using indexes) could be simply:

+Provide a function to find the closest two points among a set of given points in two dimensions, i.e. to solve the Closest pair of points problem in the planar case. +The straightforward solution is a O(n2) algorithm (which we can call brute-force algorithm); the pseudo-code (using indexes) could be simply:
-bruteForceClosestPair of P(1), P(2), ... P(N)
-if N < 2 then
-  return ∞
-else
+bruteForceClosestPair of P(1), P(2), ... P(N)
+if N < 2 then
+  return ∞
+else
   minDistance ← |P(1) - P(2)|
   minPoints ← { P(1), P(2) }
-  foreach i ∈ [1, N-1]
-    foreach j ∈ [i+1, N]
-      if |P(i) - P(j)| < minDistance then
+  foreach i ∈ [1, N-1]
+    foreach j ∈ [i+1, N]
+      if |P(i) - P(j)| < minDistance then
         minDistance ← |P(i) - P(j)|
         minPoints ← { P(i), P(j) }
-      endif
-    endfor
-  endfor
-  return minDistance, minPoints
-endif
+      endif
+    endfor
+  endfor
+  return minDistance, minPoints
+endif
 
-

A better algorithm is based on the recursive divide&conquer approach, as explained also at Wikipedia's Closest pair of points problem, which is O(n log n); a pseudo-code could be:

+A better algorithm is based on the recursive divide & conquer approach, as explained also at Wikipedia's Closest pair of points problem, which is O(n log n); a pseudo-code could be:
-closestPair of (xP, yP)
+closestPair of (xP, yP)
   where xP is P(1) .. P(N) sorted by x coordinate, and
   yP is P(1) .. P(N) sorted by y coordinate (ascending order)
-if N ≤ 3 then
-  return closest points of xP using brute-force algorithm
-else
+if N ≤ 3 then
+  return closest points of xP using brute-force algorithm
+else
   xL ← points of xP from 1 to ⌈N/2⌉
   xR ← points of xP from ⌈N/2⌉+1 to N
   xm ← xP(⌈N/2⌉)x
@@ -42,31 +42,33 @@ else
   (dL, pairL) ← closestPair of (xL, yL)
   (dR, pairR) ← closestPair of (xR, yR)
   (dmin, pairMin) ← (dR, pairR)
-  if dL < dR then
+  if dL < dR then
     (dmin, pairMin) ← (dL, pairL)
-  endif
+  endif
   yS ← { p ∈ yP : |xm - px| < dmin }
   nS ← number of points in yS
   (closest, closestPair) ← (dmin, pairMin)
-  for i from 1 to nS - 1
+  for i from 1 to nS - 1
     k ← i + 1
-    while k ≤ nS and yS(k)y - yS(i)y < dmin
-      if |yS(k) - yS(i)| < closest then
+    while k ≤ nS and yS(k)y - yS(i)y < dmin
+      if |yS(k) - yS(i)| < closest then
         (closest, closestPair) ← (|yS(k) - yS(i)|, {yS(k), yS(i)})
-      endif
+      endif
       k ← k + 1
-    endwhile
-  endfor
-  return closest, closestPair
-endif
+    endwhile
+  endfor
+  return closest, closestPair
+endif
 
-References and further readings: - Closest pair of points problem - Closest Pair (McGill) - Closest Pair (UCSB) - Closest pair (WUStL) - Closest pair (IUPUI) -

For the input, expect the argument to be an array of objects (points) with x and y members set to numbers. For the output, return an object containing the key:value pairs for distance and pair (i.e., the pair of two closest points).

+For the input, expect the argument to be an array of objects (points) with x and y members set to numbers. For the output, return an object containing the key:value pairs for distance and pair (the pair of two closest points). +References and further readings: +
## Instructions diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/combinations.english.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/combinations.english.md index 8cc3a34f4d..03d2959cef 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/combinations.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/combinations.english.md @@ -6,10 +6,9 @@ challengeType: 5 ## Description
-Task: -

Given non-negative integers m and n, generate all size m combinations of the integers from 0 (zero) to n-1 in sorted order (each combination is sorted and the entire table is sorted).

-Example: -

3 comb 5 is:

+Given non-negative integers m and n, generate all size m combinations of the integers from 0 (zero) to n-1 in sorted order (each combination is sorted and the entire table is sorted). +Example: +3 comb 5 is:
 0 1 2
 0 1 3
diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/comma-quibbling.english.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/comma-quibbling.english.md
index 294dd5474c..48effb8573 100644
--- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/comma-quibbling.english.md
+++ b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/comma-quibbling.english.md
@@ -6,18 +6,22 @@ challengeType: 5
 
 ## Description
 
-

Comma quibbling is a task originally set by Eric Lippert in his blog.

-Task:

Write a function to generate a string output which is the concatenation of input words from a list/sequence where:

-An input of no words produces the output string of just the two brace characters "{}". -An input of just one word, e.g. ["ABC"], produces the output string of the word inside the two braces, e.g. "{ABC}". -An input of two words, e.g. ["ABC", "DEF"], produces the output string of the two words inside the two braces with the words separated by the string " and ", e.g. "{ABC and DEF}". -An input of three or more words, e.g. ["ABC", "DEF", "G", "H"], produces the output string of all but the last word separated by ", " with the last word separated by " and " and all within braces; e.g. "{ABC, DEF, G and H}". -

Test your function with the following series of inputs showing your output here on this page:

-[] # (No input words). -["ABC"] -["ABC", "DEF"] -["ABC", "DEF", "G", "H"] -

Note: Assume words are non-empty strings of uppercase characters for this task.

+Comma quibbling is a task originally set by Eric Lippert in his blog. +Write a function to generate a string output which is the concatenation of input words from a list/sequence where: +
    +
  1. An input of no words produces the output string of just the two brace characters "{}".
  2. +
  3. An input of just one word, e.g. ["ABC"], produces the output string of the word inside the two braces, e.g. "{ABC}".
  4. +
  5. An input of two words, e.g. ["ABC", "DEF"], produces the output string of the two words inside the two braces with the words separated by the string " and ", e.g. "{ABC and DEF}".
  6. +
  7. An input of three or more words, e.g. ["ABC", "DEF", "G", "H"], produces the output string of all but the last word separated by ", " with the last word separated by " and " and all within braces; e.g. "{ABC, DEF, G and H}".
  8. +
+Test your function with the following series of inputs showing your output here on this page: +
    +
  • [] # (No input words).
  • +
  • ["ABC"]
  • +
  • ["ABC", "DEF"]
  • +
  • ["ABC", "DEF", "G", "H"]
  • +
+Note: Assume words are non-empty strings of uppercase characters for this task.
## Instructions diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/compare-a-list-of-strings.english.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/compare-a-list-of-strings.english.md index 0f3d403f4e..50883afb3d 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/compare-a-list-of-strings.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/compare-a-list-of-strings.english.md @@ -6,8 +6,11 @@ challengeType: 5 ## Description
-

Given a list of arbitrarily many strings, implement a function for each of the following conditions:

test if they are all lexically equal - test if every string is lexically less than the one after it (i.e. whether the list is in strict ascending order) +Given a list of arbitrarily many strings, implement a function for each of the following conditions: +
    +
  • test if they are all lexically equal
  • +
  • test if every string is lexically less than the one after it (i.e. whether the list is in strict ascending order)
  • +
## Instructions diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/convert-seconds-to-compound-duration.english.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/convert-seconds-to-compound-duration.english.md index 7fc63db3ac..bd6824155f 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/convert-seconds-to-compound-duration.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/convert-seconds-to-compound-duration.english.md @@ -6,69 +6,82 @@ challengeType: 5 ## Description
-Task: -

Implement a function which:

-takes a positive integer representing a duration in seconds as input (e.g., 100), and -returns a string which shows the same duration decomposed into weeks, days, hours, minutes, and seconds as detailed below (e.g., 1 min, 40 sec). -

Demonstrate that it passes the following three test-cases:

Test Cases

+Implement a function which: +
    +
  • takes a positive integer representing a duration in seconds as input (e.g., 100), and
  • +
  • returns a string which shows the same duration decomposed into weeks, days, hours, minutes, and seconds as detailed below (e.g., 1 min, 40 sec).
  • +
+Demonstrate that it passes the following three test-cases: +
Test Cases
- - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + +
input numberoutput number
72592 hr, 59 sec
864001 d
60000009 wk, 6 d, 10 hr, 40 min
input numberoutput number
72592 hr, 59 sec
864001 d
60000009 wk, 6 d, 10 hr, 40 min
-

Details

-The following five units should be used: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
unitsuffix used in outputconversion
weekwk1 week = 7 days
dayd1 day = 24 hours
hourhr1 hour = 60 minutes
minutemin1 minute = 60 seconds
secondsec
-However, only include quantities with non-zero values in the output (e.g., return 1 d and not 0 wk, 1 d, 0 hr, 0 min, 0 sec).Give larger units precedence over smaller ones as much as possible (e.g., return 2 min, 10 sec and not 1 min, 70 sec or 130 sec)Mimic the formatting shown in the test-cases (quantities sorted from largest unit to smallest and separated by comma+space; value and unit of each quantity separated by space). -


+
Details
+
    +
  • + The following five units should be used: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    unitsuffix used in outputconversion
    weekwk1 week = 7 days
    dayd1 day = 24 hours
    hourhr1 hour = 60 minutes
    minutemin1 minute = 60 seconds
    secondsec
    +
  • +
  • + However, only include quantities with non-zero values in the output (e.g., return 1 d and not 0 wk, 1 d, 0 hr, 0 min, 0 sec). +
  • +
  • + Give larger units precedence over smaller ones as much as possible (e.g., return 2 min, 10 sec and not 1 min, 70 sec or 130 sec). +
  • +
  • + Mimic the formatting shown in the test-cases (quantities sorted from largest unit to smallest and separated by comma+space; value and unit of each quantity separated by space). +
  • +
## Instructions diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/count-occurrences-of-a-substring.english.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/count-occurrences-of-a-substring.english.md index 3ecd2715d5..a25ed5e53a 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/count-occurrences-of-a-substring.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/count-occurrences-of-a-substring.english.md @@ -6,12 +6,15 @@ challengeType: 5 ## Description
-Task: -

Create a function, or show a built-in function, to count the number of non-overlapping occurrences of a substring inside a string.

The function should take two arguments:

-the first argument being the string to search, and -the second a substring to be searched for. -

It should return an integer count.

-

The matching should yield the highest number of non-overlapping matches.

In general, this essentially means matching from left-to-right or right-to-left.

+Create a function, or show a built-in function, to count the number of non-overlapping occurrences of a substring inside a string. +The function should take two arguments: +
    +
  • the first argument being the string to search, and
  • +
  • the second a substring to be searched for.
  • +
+It should return an integer count. +The matching should yield the highest number of non-overlapping matches. +In general, this essentially means matching from left-to-right or right-to-left.
## Instructions diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/count-the-coins.english.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/count-the-coins.english.md index 04f3e5d2c4..2348ac3a3a 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/count-the-coins.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/count-the-coins.english.md @@ -6,22 +6,27 @@ challengeType: 5 ## Description
-

There are four types of common coins in US currency:

-quarters (25 cents) -dimes (10 cents) -nickels (5 cents), and -pennies (1 cent) +There are four types of common coins in US currency: +
    +
  • quarters (25 cents)
  • +
  • dimes (10 cents)
  • +
  • nickels (5 cents), and
  • +
  • pennies (1 cent)
  • +

There are six ways to make change for 15 cents:

-A dime and a nickel -A dime and 5 pennies -3 nickels -2 nickels and 5 pennies -A nickel and 10 pennies -15 pennies -Task: -

Implement a function to determine how many ways there are to make change for a dollar using these common coins? (1 dollar = 100 cents).

-Reference: - an algorithm from MIT Press. +
    +
  • A dime and a nickel
  • +
  • A dime and 5 pennies
  • +
  • 3 nickels
  • +
  • 2 nickels and 5 pennies
  • +
  • A nickel and 10 pennies
  • +
  • 15 pennies
  • +
+Implement a function to determine how many ways there are to make change for a dollar using these common coins? (1 dollar = 100 cents) +Reference: +
## Instructions diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/cramers-rule.english.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/cramers-rule.english.md index c17683e58e..b614340ef6 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/cramers-rule.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/cramers-rule.english.md @@ -6,25 +6,30 @@ challengeType: 5 ## Description
-

In linear algebra, Cramer's rule is an explicit formula for the solution of a system of linear equations with as many equations as unknowns, valid whenever the system has a unique solution. It expresses the solution in terms of the determinants of the (square) coefficient matrix and of matrices obtained from it by replacing one column by the vector of right hand sides of the equations.

-

Given

-

-

$\left\{\begin{matrix}a_1x + b_1y + c_1z&= {\color{red}d_1}\\a_2x + b_2y + c_2z&= {\color{red}d_2}\\a_3x + b_3y + c_3z&= {\color{red}d_3}\end{matrix}\right.$

-

which in matrix format is

-

$\begin{bmatrix} a_1 & b_1 & c_1 \\ a_2 & b_2 & c_2 \\ a_3 & b_3 & c_3 \end{bmatrix}\begin{bmatrix} x \\ y \\ z \end{bmatrix}=\begin{bmatrix} {\color{red}d_1} \\ {\color{red}d_2} \\ {\color{red}d_3} \end{bmatrix}.$

-

Then the values of $x, y$ and $z$ can be found as follows:

-

$x = \frac{\begin{vmatrix} {\color{red}d_1} & b_1 & c_1 \\ {\color{red}d_2} & b_2 & c_2 \\ {\color{red}d_3} & b_3 & c_3 \end{vmatrix} } { \begin{vmatrix} a_1 & b_1 & c_1 \\ a_2 & b_2 & c_2 \\ a_3 & b_3 & c_3 \end{vmatrix}}, \quad y = \frac {\begin{vmatrix} a_1 & {\color{red}d_1} & c_1 \\ a_2 & {\color{red}d_2} & c_2 \\ a_3 & {\color{red}d_3} & c_3 \end{vmatrix}} {\begin{vmatrix} a_1 & b_1 & c_1 \\ a_2 & b_2 & c_2 \\ a_3 & b_3 & c_3 \end{vmatrix}}, \text{ and }z = \frac { \begin{vmatrix} a_1 & b_1 & {\color{red}d_1} \\ a_2 & b_2 & {\color{red}d_2} \\ a_3 & b_3 & {\color{red}d_3} \end{vmatrix}} {\begin{vmatrix} a_1 & b_1 & c_1 \\ a_2 & b_2 & c_2 \\ a_3 & b_3 & c_3 \end{vmatrix} }.$

+In linear algebra, Cramer's rule is an explicit formula for the solution of a system of linear equations with as many equations as unknowns, valid whenever the system has a unique solution. It expresses the solution in terms of the determinants of the (square) coefficient matrix and of matrices obtained from it by replacing one column by the vector of right hand sides of the equations. +Given + + $\left\{\begin{matrix}a_1x + b_1y + c_1z&= {\color{red}d_1}\\a_2x + b_2y + c_2z&= {\color{red}d_2}\\a_3x + b_3y + c_3z&= {\color{red}d_3}\end{matrix}\right.$ -Task -

Given the following system of equations:

-$\begin{cases} -2w-x+5y+z=-3 \\ -3w+2x+2y-6z=-32 \\ -w+3x+3y-z=-47 \\ -5w-2x-3y+3z=49 \\ -\end{cases}$ -

-

solve for $w$, $x$, $y$ and $z$, using Cramer's rule.

+which in matrix format is + + $\begin{bmatrix} a_1 & b_1 & c_1 \\ a_2 & b_2 & c_2 \\ a_3 & b_3 & c_3 \end{bmatrix}\begin{bmatrix} x \\ y \\ z \end{bmatrix}=\begin{bmatrix} {\color{red}d_1} \\ {\color{red}d_2} \\ {\color{red}d_3} \end{bmatrix}.$ + +Then the values of $x, y$ and $z$ can be found as follows: + + $x = \frac{\begin{vmatrix} {\color{red}d_1} & b_1 & c_1 \\ {\color{red}d_2} & b_2 & c_2 \\ {\color{red}d_3} & b_3 & c_3 \end{vmatrix} } { \begin{vmatrix} a_1 & b_1 & c_1 \\ a_2 & b_2 & c_2 \\ a_3 & b_3 & c_3 \end{vmatrix}}, \quad y = \frac {\begin{vmatrix} a_1 & {\color{red}d_1} & c_1 \\ a_2 & {\color{red}d_2} & c_2 \\ a_3 & {\color{red}d_3} & c_3 \end{vmatrix}} {\begin{vmatrix} a_1 & b_1 & c_1 \\ a_2 & b_2 & c_2 \\ a_3 & b_3 & c_3 \end{vmatrix}}, \text{ and }z = \frac { \begin{vmatrix} a_1 & b_1 & {\color{red}d_1} \\ a_2 & b_2 & {\color{red}d_2} \\ a_3 & b_3 & {\color{red}d_3} \end{vmatrix}} {\begin{vmatrix} a_1 & b_1 & c_1 \\ a_2 & b_2 & c_2 \\ a_3 & b_3 & c_3 \end{vmatrix} }.$ + +Task +Given the following system of equations: + + $\begin{cases} + 2w-x+5y+z=-3 \\ + 3w+2x+2y-6z=-32 \\ + w+3x+3y-z=-47 \\ + 5w-2x-3y+3z=49 \\ + \end{cases}$ + +solve for $w$, $x$, $y$ and $z$, using Cramer's rule.
## Instructions diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/cut-a-rectangle.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/cut-a-rectangle.md index 61737ed21d..007c5497d9 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/cut-a-rectangle.md +++ b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/cut-a-rectangle.md @@ -7,7 +7,11 @@ challengeType: 5 ## Description
A given rectangle is made from m × n squares. If m and n are not both odd, then it is possible to cut a path through the rectangle along the square edges such that the rectangle splits into two connected pieces with the same shape (after rotating one of the pieces by 180°). All such paths for 2 × 2 and 4 × 3 rectangles are shown below. -file:rect-cut.svg +
+ + Picture of cut rectangles + +
Write a function that calculates the number of different ways to cut an m × n rectangle.