You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: chapter-09-problems-for-champions-part-2.md
+6-6
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ In this chapter we will review three additional problems that belong to the cate
8
8
Before we move on to particular tasks, we must clarify that these can be solved more easily with **additional knowledge in programming with JavaScript**\(functions, arrays, collections, recursion, etc.\), but each solution that will be provided now only uses the material covered in this book. The goal is to learn how to construct **more complex algorithms** based on your knowledge collected up to the present moment.
9
9
10
10
11
-
## Problem: Passion Shopping Days
11
+
## Problem: Passion Days
12
12
13
13
Lina has a real shopping passion. When she has some money, she immediately goes to the closest shopping center (mall) and tries to spend as much as she can on clothes, bags, and shoes. But her favorite thing is winter sales. Our task is to analyze her strange behavior and **calculate the purchases** that Lina does when she enters the mall, as well as the **money she has left** when the shopping is over. All prices and money are in BGN (Bulgarian levs, **lv**).
14
14
@@ -66,7 +66,7 @@ We will separate the solution of the problem into three main parts:
66
66
67
67
Let's examine each of the parts in detail.
68
68
69
-
#### Processing the Input Data
69
+
#### Processing The Input Data
70
70
71
71
The input of our task consists of a few components:
72
72
- In the **first argument, we have all the money** that Lina has for shopping.
@@ -91,7 +91,7 @@ The algorithm for solving the problem is a direct one – we continue **reading
91
91
92
92
Let's examine the first two problems for our algorithm. The first problem concerns the way we read the commands until we reach the **"mall.Exit"** command. The solution that we previously saw uses a **`while-loop`**. The second problem for the task is to **access each symbol** of the command passed. Keeping in mind that the input data with the commands is a **`string`** type, the easiest way to access each symbol inside the strings is via a **`foreach` loop**.
@@ -132,7 +132,7 @@ How can we do that? We will leave the answer to this question to the reader.
132
132
### Testing in The Judge System
133
133
Test your solution here: [https://judge.softuni.org/Contests/Practice/Index/942#0](https://judge.softuni.org/Contests/Practice/Index/942#0).
134
134
135
-
## Problem: Numerical Expression
135
+
## Problem: X Expression
136
136
137
137
Bonny is an exceptionally powerful witch. As her natural power is not sufficient to successfully fight vampires and werewolves, she has started to master the power of Expressions. An expression is very hard to master because the spell relies on the ability to **quickly solve mathematical expressions**.
138
138
@@ -144,7 +144,7 @@ The expression is solved without considering the mathematical rules for calculat
@@ -294,7 +294,7 @@ Because our input comes directly as an argument of our function we can do the fo
294
294
- We will generate all possible **four-digit combinations** (candidates for verification).
295
295
- For each generated combination we will calculate **how many bulls** and **how many cows** it has according to the secret number. Upon matching the needed bulls and cows, we will **print the combination**.
296
296
297
-
#### Algorithm for Solving the Problem
297
+
#### Algorithm for Solving The Problem
298
298
299
299
Before starting to write the algorithm for solving our problem, we must **declare a flag** that indicates whether a solution is found:
0 commit comments