Skip to content

Commit 999ac69

Browse files
committed
curriculum updates
1 parent 43702e0 commit 999ac69

15 files changed

Lines changed: 162 additions & 8036 deletions

File tree

package-lock.json

Lines changed: 0 additions & 7909 deletions
This file was deleted.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"preview": "vite preview"
1111
},
1212
"dependencies": {
13-
"@nss-workshops/nss-core": "0.2.23",
13+
"@nss-workshops/nss-core": "0.2.24",
1414
"@emotion/react": "^11.11.3",
1515
"@monaco-editor/react": "^4.7.0",
1616
"@testing-library/react": "^16.2.0",

src/sections/04-arrays-and-two-pointers/02-arrays-intro/index.md

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,12 @@ console.log(mayasOrders.length); // 3
8686
// ==============================
8787
```
8888

89-
- Implement the required logic
90-
- Click \`Run Code\`
91-
- Inspect \`📋 Console Output\` window for correctness!
89+
- Read the requirements written as comments in the code.
90+
- Implement the required logic.
91+
- Click `Run Code` and inspect `📋 Console Output` window for correctness!
92+
- Click `Run Tests`and ensure that test(s) related to this specific exercise are passing <span class="mtk8"> Passing test will show in green text.</span>
93+
94+
🚧 *Some tests for future exercises may fail at first — that’s expected. As you complete each exercise, those tests will start passing. By the time you finish the final exercise, all tests in the test suite should pass.*
9295

9396
---
9497

@@ -148,9 +151,12 @@ orders.splice(0, 0, "Priority Order"); // Potentially slow with many orders
148151
// ==============================
149152
```
150153

151-
- Implement the required logic
152-
- Click \`Run Code\`
153-
- Inspect \`📋 Console Output\` window for correctness!
154+
- Read the requirements written as comments in the code.
155+
- Implement the required logic.
156+
- Click `Run Code` and inspect `📋 Console Output` window for correctness!
157+
- Click `Run Tests`and ensure that test(s) related to this specific exercise are passing <span class="mtk8"> Passing test will show in green text.</span>
158+
159+
🚧 *Some tests for future exercises may fail at first — that’s expected. As you complete each exercise, those tests will start passing. By the time you finish the final exercise, all tests in the test suite should pass.*
154160

155161
---
156162

@@ -226,9 +232,12 @@ console.log(orders); // ["Second"]
226232
// ==============================
227233
```
228234

229-
- Implement the required logic
230-
- Click \`Run Code\`
231-
- Inspect \`📋 Console Output\` window for correctness!
235+
- Read the requirements written as comments in the code.
236+
- Implement the required logic.
237+
- Click `Run Code` and inspect `📋 Console Output` window for correctness!
238+
- Click `Run Tests`and ensure that test(s) related to this specific exercise are passing <span class="mtk8"> Passing test will show in green text.</span>
239+
240+
🚧 *Some tests for future exercises may fail at first — that’s expected. As you complete each exercise, those tests will start passing. By the time you finish the final exercise, all tests in the test suite should pass.*
232241

233242
---
234243

@@ -304,9 +313,12 @@ processOrderQueue(mayasQueue);
304313
// ==============================
305314
```
306315

307-
- Implement the required logic
308-
- Click \`Run Code\`
309-
- Inspect \`📋 Console Output\` window for correctness!
316+
- Read the requirements written as comments in the code.
317+
- Implement the required logic.
318+
- Click `Run Code` and inspect `📋 Console Output` window for correctness!
319+
- Click `Run Tests`and ensure that test(s) related to this specific exercise are passing <span class="mtk8"> Passing test will show in green text.</span>
320+
321+
🚧 *Some tests for future exercises may fail at first — that’s expected. As you complete each exercise, those tests will start passing. By the time you finish the final exercise, all tests in the test suite should pass.*
310322

311323
---
312324

src/sections/04-arrays-and-two-pointers/02-arrays-intro/starterCode.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// ==============================
33
// Exercise 1: Help Maya Add Multiple Orders
44
// ==============================
5-
// Uncomment this block and click "Run Code" to complete the exercise
65
// Task: Create a function \`addOrders\` that helps Maya add multiple orders to her array
76
// The function should add: "Flat White", "Cold Brew", "Double Espresso"
87

@@ -18,7 +17,6 @@
1817
// ==============================
1918
// Exercise 2: Handle Priority Orders During Rush
2019
// ==============================
21-
// Uncomment this block and click "Run Code" to complete the exercise
2220
// Task: Help Maya insert two VIP orders at the front of her queue
2321
// Insert "VIP: Affogato" and "VIP: Cortado" at positions 0 and 1
2422

@@ -32,7 +30,6 @@
3230
// ==============================
3331
// Exercise 3: Fix Multiple Order Mistakes
3432
// ==============================
35-
// Uncomment this block and click "Run Code" to complete the exercise
3633
// Task: Maya made some mistakes! Help her fix them:
3734
// 1. Remove the two incorrect orders at indices 2 and 3
3835
// 2. Update the first order from "Latter" to "Latte"
@@ -46,7 +43,6 @@
4643
// ==============================
4744
// Exercise 4: Create an Efficient Order Processing System
4845
// ==============================
49-
// Uncomment this block and click "Run Code" to complete the exercise
5046
// Task: Help Maya create a function that processes orders and shows progress
5147
// The function should loop through all orders and print each one with its position
5248

src/sections/04-arrays-and-two-pointers/03-array-core-operations/index.md

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,13 @@ function findSongByTitle(setlist, title) {
6565
// Exercise 1: Help Alex Access Songs by Position
6666
// ==============================
6767
```
68+
- Read the requirements written as comments in the code.
69+
- Implement the required logic.
70+
- Click `Run Code` and inspect `📋 Console Output` window for correctness!
71+
- Click `Run Tests`and ensure that test(s) related to this specific exercise are passing <span class="mtk8"> Passing test will show in green text.</span>
72+
73+
🚧 *Some tests for future exercises may fail at first — that’s expected. As you complete each exercise, those tests will start passing. By the time you finish the final exercise, all tests in the test suite should pass.*
6874

69-
- Implement the required logic
70-
- Click `Run Code`
71-
- Inspect `📋 Console Output` window for correctness!
7275

7376
---
7477

@@ -142,16 +145,19 @@ console.log(customSet);
142145

143146
---
144147
## ⏱️ **Alex's Rehearsal Challenge!**
145-
- 🔓 Uncomment this block and click "Run Code" to complete the exercise:
148+
- 🔓 Uncomment the below code section in the editor 👉:
146149
```js
147150
// ==============================
148151
// Exercise 2: Help Alex Update Their Setlist
149152
// ==============================
150153
```
151154

152-
- Implement the required logic
153-
- Click `Run Code`
154-
- Inspect `📋 Console Output` window for correctness!
155+
- Read the requirements written as comments in the code.
156+
- Implement the required logic.
157+
- Click `Run Code` and inspect `📋 Console Output` window for correctness!
158+
- Click `Run Tests`and ensure that test(s) related to this specific exercise are passing <span class="mtk8"> Passing test will show in green text.</span>
159+
160+
🚧 *Some tests for future exercises may fail at first — that’s expected. As you complete each exercise, those tests will start passing. By the time you finish the final exercise, all tests in the test suite should pass.*
155161

156162
---
157163

@@ -268,16 +274,18 @@ function carefulSongManagement() {
268274

269275
---
270276
## ⏱️ **Alex's Performance Challenge!**
271-
- 🔓 Uncomment this block and click "Run Code" to complete the exercise:
277+
- 🔓 Uncomment the below code section in the editor 👉:
272278
```js
273279
// ==============================
274280
// Exercise 3: Help Alex Add Songs Strategically
275281
// ==============================
276282
```
283+
- Read the requirements written as comments in the code.
284+
- Implement the required logic.
285+
- Click `Run Code` and inspect `📋 Console Output` window for correctness!
286+
- Click `Run Tests`and ensure that test(s) related to this specific exercise are passing <span class="mtk8"> Passing test will show in green text.</span>
277287

278-
- Implement the required logic
279-
- Click `Run Code`
280-
- Inspect `📋 Console Output` window for correctness!
288+
🚧 *Some tests for future exercises may fail at first — that’s expected. As you complete each exercise, those tests will start passing. By the time you finish the final exercise, all tests in the test suite should pass.*
281289

282290
---
283291

@@ -398,16 +406,19 @@ console.log("Quick edits for efficiency, careful edits for artistry!");
398406

399407
---
400408
## ⏱️ **Alex's Late Night Challenge!**
401-
- 🔓 Uncomment this block and click "Run Code" to complete the exercise:
409+
- 🔓 Uncomment the below code section in the editor 👉:
402410
```js
403411
// ==============================
404412
// Exercise 4: Help Alex Remove Songs Strategically
405413
// ==============================
406414
```
407415

408-
- Implement the required logic
409-
- Click `Run Code`
410-
- Inspect `📋 Console Output` window for correctness!
416+
- Read the requirements written as comments in the code.
417+
- Implement the required logic.
418+
- Click `Run Code` and inspect `📋 Console Output` window for correctness!
419+
- Click `Run Tests`and ensure that test(s) related to this specific exercise are passing <span class="mtk8"> Passing test will show in green text.</span>
420+
421+
🚧 *Some tests for future exercises may fail at first — that’s expected. As you complete each exercise, those tests will start passing. By the time you finish the final exercise, all tests in the test suite should pass.*
411422

412423
---
413424

@@ -550,16 +561,18 @@ console.log("Random inspiration:", alexsFinder.getRandomSong());
550561

551562
---
552563
## ⏱️ **Alex's Encore Challenge!**
553-
- 🔓 Uncomment this block and click "Run Code" to complete the exercise:
564+
- 🔓 Uncomment the below code section in the editor 👉:
554565
```js
555566
// ==============================
556567
// Exercise 5: Help Alex Find Songs for Requests
557568
// ==============================
558569
```
570+
- Read the requirements written as comments in the code.
571+
- Implement the required logic.
572+
- Click `Run Code` and inspect `📋 Console Output` window for correctness!
573+
- Click `Run Tests`and ensure that test(s) related to this specific exercise are passing <span class="mtk8"> Passing test will show in green text.</span>
559574

560-
- Implement the required logic
561-
- Click `Run Code`
562-
- Inspect `📋 Console Output` window for correctness!
575+
🚧 *Some tests for future exercises may fail at first — that’s expected. As you complete each exercise, those tests will start passing. By the time you finish the final exercise, all tests in the test suite should pass.*
563576

564577
---
565578

@@ -615,14 +628,4 @@ const song = setlist.find(s => s.mood === "romantic"); // Find by criteria
615628
3. **Design your setlist structure** to favor the operations you'll use most frequently
616629
4. **Batch similar operations** when possible to minimize disruption
617630

618-
### 🌟 **From Street Musician to Array Expert**
619-
620-
Alex started the evening as a talented musician with a disorganized approach to setlist management. By the end of the night, they've not only delivered an amazing performance but also mastered the four core array operations that form the foundation of efficient programming.
621-
622-
"The beautiful thing," Alex tells Marcus while settling up for the night, "is that these same principles apply whether you're managing songs, customer orders, inventory items, or any other collection of data. Once you understand access, update, add, and remove operations - and their performance characteristics - you can efficiently manage any array-based system."
623-
624-
Marcus nods approvingly, "Same time next week?"
625-
626-
Alex grins, slinging their guitar over their shoulder, "Absolutely. I've got some new songs to add to my repertoire - and I know exactly where to put them in my setlist for maximum impact!"
627-
628631
*Ready for the next challenge? Let's see how Alex uses these core operations to master advanced array methods and create even more sophisticated musical experiences...*

src/sections/04-arrays-and-two-pointers/03-array-core-operations/solution.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
function getSongAtPosition(setlist, position) {
55
// Return the song at the given position
66
// Handle invalid positions gracefully
7+
// Return the string "Position out of bounds" if position is invalid
78
if (position < 0 || position >= setlist.length) {
89
return "Position out of bounds";
910
}

src/sections/04-arrays-and-two-pointers/03-array-core-operations/starterCode.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
// ==============================
22
// Exercise 1: Help Alex Access Songs by Position
33
// ==============================
4-
// Uncomment this block and click "Run Code" to complete the exercise
54
// Task: Create a function that helps Alex quickly access songs from their setlist
65

76
// function getSongAtPosition(setlist, position) {
87
// // Return the song at the given position
98
// // Handle invalid positions gracefully
9+
// // Return the string "Position out of bounds" if position is invalid
1010
// }
1111

1212
// const alexsSetlist = ["Wonderwall", "Hotel California", "Blackbird", "Free Bird"];
@@ -16,12 +16,12 @@
1616
// ==============================
1717
// Exercise 2: Help Alex Update Their Setlist
1818
// ==============================
19-
// Uncomment this block and click "Run Code" to complete the exercise
2019
// Task: Create a function that updates multiple songs based on audience feedback
2120

2221
// function updateSetlistBasedOnFeedback(setlist, updates) {
2322
// // updates is an object like { 0: "New Song", 2: "Another Song" }
2423
// // Update the setlist at the specified positions
24+
// // Hint 1: Object keys are always returned as strings
2525
// return setlist;
2626
// }
2727

@@ -33,7 +33,6 @@
3333
// ==============================
3434
// Exercise 3: Help Alex Add Songs Strategically
3535
// ==============================
36-
// Uncomment this block and click "Run Code" to complete the exercise
3736
// Task: Create a function that adds songs using the most efficient method based on position
3837

3938
// function addSongStrategically(setlist, song, position) {
@@ -52,7 +51,6 @@
5251
// ==============================
5352
// Exercise 4: Help Alex Remove Songs Strategically
5453
// ==============================
55-
// Uncomment this block and click "Run Code" to complete the exercise
5654
// Task: Create a function that removes songs using the most efficient method
5755

5856
// function removeSongStrategically(setlist, position) {
@@ -71,7 +69,6 @@
7169
// ==============================
7270
// Exercise 5: Help Alex Find Songs for Requests
7371
// ==============================
74-
// Uncomment this block and click "Run Code" to complete the exercise
7572
// Task: Create a function that finds songs matching specific criteria
7673

7774
// function findSongsForRequest(repertoire, criteria) {

src/sections/04-arrays-and-two-pointers/04-array-tradeoffs/index.md

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,12 @@ visualizePriorityInsertion([...largeQueue], "VIP Order");
9494
// Exercise 1: Measure the Impact of Scale
9595
// ==============================
9696
```
97+
- Read the requirements written as comments in the code.
98+
- Implement the required logic.
99+
- Click `Run Code` and inspect `📋 Console Output` window for correctness!
100+
- Click `Run Tests`and ensure that test(s) related to this specific exercise are passing <span class="mtk8"> Passing test will show in green text.</span>
97101

98-
- Implement the required logic
99-
- Click `Run Code`
100-
- Inspect `📋 Console Output` window for correctness!
102+
🚧 *Some tests for future exercises may fail at first — that’s expected. As you complete each exercise, those tests will start passing. By the time you finish the final exercise, all tests in the test suite should pass.*
101103

102104
---
103105

@@ -200,17 +202,21 @@ Maya studies the output. "Yes! The closer to the beginning we delete, the more o
200202
"Exactly! This is why we call it **O(n) time complexity** - the time it takes grows linearly with the number of elements that need to shift."
201203

202204
---
203-
## ⏱️ **Maya's Deletion Detective Challenge!**
205+
## ⏱️ **Maya's Deletion Detective Challenge!**
204206
- 🔓 Uncomment the below code section in the editor 👉:
205207
```js
206208
// ==============================
207209
// Exercise 2: Analyze Deletion Performance Patterns
208210
// ==============================
209211
```
210212

211-
- Implement the required logic
212-
- Click `Run Code`
213-
- Inspect `📋 Console Output` window for correctness!
213+
- Read the requirements written as comments in the code.
214+
- Implement the required logic.
215+
- Click `Run Code` and inspect `📋 Console Output` window for correctness!
216+
- Click `Run Tests`and ensure that test(s) related to this specific exercise are passing <span class="mtk8"> Passing test will show in green text.</span>
217+
218+
🚧 *Some tests for future exercises may fail at first — that’s expected. As you complete each exercise, those tests will start passing. By the time you finish the final exercise, all tests in the test suite should pass.*
219+
214220

215221
---
216222

@@ -296,9 +302,13 @@ class SmartCoffeeQueue {
296302
// ==============================
297303
```
298304

299-
- Implement the required logic
300-
- Click `Run Code`
301-
- Inspect `📋 Console Output` window for correctness!
305+
- Read the requirements written as comments in the code.
306+
- Implement the required logic.
307+
- Click `Run Code` and inspect `📋 Console Output` window for correctness!
308+
- Click `Run Tests`and ensure that test(s) related to this specific exercise are passing <span class="mtk8"> Passing test will show in green text.</span>
309+
310+
🚧 *Some tests for future exercises may fail at first — that’s expected. As you complete each exercise, those tests will start passing. By the time you finish the final exercise, all tests in the test suite should pass.*
311+
302312

303313
---
304314

@@ -400,9 +410,12 @@ PerformanceTester.compareStrategies();
400410
// ==============================
401411
```
402412

403-
- Implement the required logic
404-
- Click `Run Code`
405-
- Inspect `📋 Console Output` window for correctness!
413+
- Read the requirements written as comments in the code.
414+
- Implement the required logic.
415+
- Click `Run Code` and inspect `📋 Console Output` window for correctness!
416+
- Click `Run Tests`and ensure that test(s) related to this specific exercise are passing <span class="mtk8"> Passing test will show in green text.</span>
417+
418+
🚧 *Some tests for future exercises may fail at first — that’s expected. As you complete each exercise, those tests will start passing. By the time you finish the final exercise, all tests in the test suite should pass.*
406419

407420
---
408421

src/sections/04-arrays-and-two-pointers/04-array-tradeoffs/solution.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
// ==============================
22
// Exercise 1: Measure the Impact of Scale
33
// ==============================
4+
// No changes are needed—just run the code and the tests, and observe the differences in timing.
45
function measureInsertionScale() {
5-
const sizes = [10, 100, 1000];
6+
const sizes = [10, 10_000, 1_000_000];
67

78
sizes.forEach(size => {
89
// Create an array of the specified size

0 commit comments

Comments
 (0)