Skip to content

Commit c222fcd

Browse files
committed
feat: more examples from chapter 7
1 parent e01603e commit c222fcd

3 files changed

Lines changed: 23 additions & 0 deletions

File tree

chapter-7/10_password_cracker.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
def every_password(n)
2+
(('a' * n)...('z' * n)).each do |str|
3+
puts str
4+
end
5+
end

chapter-7/8_get_all_products.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
function twoNumberProduct(array: number[]): number[] {
2+
let products: number[] = []
3+
for (let i = 0; i < array.length - 1; i++) {
4+
for (let j = i + 1; j < array.length; j++) {
5+
products.push(array[i] * array[j])
6+
}
7+
}
8+
return products
9+
}

chapter-7/9_multiple_datasets.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
function twoNumberProductArr(array1: number[], array2: number[]): number[] {
2+
let products: number[] = []
3+
for (let i = 0; i < array1.length; i++) {
4+
for (let j = 0; j < array2.length; j++) {
5+
products.push(array1[i] * array2[j])
6+
}
7+
}
8+
return products
9+
}

0 commit comments

Comments
 (0)