Episode 7 — DSA with JavaScript / 7.2 — Loops Nested Loops Pattern Programming
7.2 — Exercise Questions: Loops, Nested Loops & Patterns
Easy
E1. Sum of 1 to N
Write a function that returns the sum of numbers from 1 to n using a loop.
Solution (JS)
function sumToN(n) {
let sum = 0;
for (let i = 1; i <= n; i++) {
sum += i;
}
return sum;
}
console.log(sumToN(10)); // 55
// Formula check: 10 * 11 / 2 = 55 ✓
Solution (C++)
int sumToN(int n) {
int sum = 0;
for (int i = 1; i <= n; i++) sum += i;
return sum;
}
E2. Factorial
Calculate n! using a loop.
Solution (JS)
function factorial(n) {
if (n < 0) return -1;
let result = 1;
for (let i = 2; i <= n; i++) result *= i;
return result;
}
E3. Reverse a Number
Given a number, return it reversed (e.g., 12345 → 54321).
Solution (JS)
function reverse(n) {
let rev = 0;
let negative = n < 0;
n = Math.abs(n);
while (n > 0) {
rev = rev * 10 + n % 10;
n = Math.floor(n / 10);
}
return negative ? -rev : rev;
}
E4. Count Digits
Count the number of digits in an integer.
Solution (JS)
function countDigits(n) {
if (n === 0) return 1;
let count = 0;
n = Math.abs(n);
while (n > 0) {
count++;
n = Math.floor(n / 10);
}
return count;
}
E5. Multiplication Table
Print the multiplication table for a given number.
Solution (JS)
function multiTable(n) {
for (let i = 1; i <= 10; i++) {
console.log(`${n} × ${i} = ${n * i}`);
}
}
Medium
E6. Print All Prime Numbers up to N
Solution (JS)
function primesUpTo(n) {
const primes = [];
for (let i = 2; i <= n; i++) {
let isPrime = true;
for (let j = 2; j * j <= i; j++) {
if (i % j === 0) { isPrime = false; break; }
}
if (isPrime) primes.push(i);
}
return primes;
}
console.log(primesUpTo(30));
// [2, 3, 5, 7, 11, 13, 17, 19, 23, 29]
E7. Fibonacci Sequence (first N terms)
Solution (JS)
function fibonacci(n) {
if (n <= 0) return [];
const fib = [0];
if (n === 1) return fib;
fib.push(1);
for (let i = 2; i < n; i++) {
fib.push(fib[i-1] + fib[i-2]);
}
return fib;
}
E8. Star Pyramid (centered)
Print a centered pyramid of height n.
Solution (JS)
function pyramid(n) {
for (let i = 0; i < n; i++) {
console.log(" ".repeat(n-1-i) + "*".repeat(2*i+1));
}
}
E9. Diamond Pattern
Solution (JS)
function diamond(n) {
for (let i = 0; i < n; i++)
console.log(" ".repeat(n-1-i) + "*".repeat(2*i+1));
for (let i = n-2; i >= 0; i--)
console.log(" ".repeat(n-1-i) + "*".repeat(2*i+1));
}
E10. Pascal's Triangle
Solution (JS)
function pascal(n) {
for (let i = 0; i < n; i++) {
let val = 1;
let row = " ".repeat(n-1-i);
for (let j = 0; j <= i; j++) {
row += val + " ";
val = val * (i-j) / (j+1);
}
console.log(row);
}
}
Hard
E11. Spiral Matrix Traversal
Given an m×n matrix, return all elements in spiral order.
Solution (JS)
function spiralOrder(matrix) {
if (!matrix.length) return [];
const result = [];
let top = 0, bottom = matrix.length - 1;
let left = 0, right = matrix[0].length - 1;
while (top <= bottom && left <= right) {
for (let i = left; i <= right; i++) result.push(matrix[top][i]);
top++;
for (let i = top; i <= bottom; i++) result.push(matrix[i][right]);
right--;
if (top <= bottom) {
for (let i = right; i >= left; i--) result.push(matrix[bottom][i]);
bottom--;
}
if (left <= right) {
for (let i = bottom; i >= top; i--) result.push(matrix[i][left]);
left++;
}
}
return result;
}
E12. Hollow Diamond
Print a hollow diamond of height 2n-1.
Solution (JS)
function hollowDiamond(n) {
for (let i = 0; i < n; i++) {
let row = " ".repeat(n-1-i);
if (i === 0) {
row += "*";
} else {
row += "*" + " ".repeat(2*i-1) + "*";
}
console.log(row);
}
for (let i = n-2; i >= 0; i--) {
let row = " ".repeat(n-1-i);
if (i === 0) {
row += "*";
} else {
row += "*" + " ".repeat(2*i-1) + "*";
}
console.log(row);
}
}
E13. Number Spiral Matrix
Fill an n×n matrix with numbers 1 to n² in spiral order.
Solution (JS)
function spiralMatrix(n) {
const matrix = Array.from({length: n}, () => Array(n).fill(0));
let num = 1;
let top = 0, bottom = n-1, left = 0, right = n-1;
while (num <= n * n) {
for (let i = left; i <= right && num <= n*n; i++) matrix[top][i] = num++;
top++;
for (let i = top; i <= bottom && num <= n*n; i++) matrix[i][right] = num++;
right--;
for (let i = right; i >= left && num <= n*n; i--) matrix[bottom][i] = num++;
bottom--;
for (let i = bottom; i >= top && num <= n*n; i--) matrix[i][left] = num++;
left++;
}
return matrix;
}
Additional exercise bank
EX-014
- Problem: Loop/pattern exercise #14.
- Difficulty: Easy
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-015
- Problem: Loop/pattern exercise #15.
- Difficulty: Easy
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-016
- Problem: Loop/pattern exercise #16.
- Difficulty: Easy
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-017
- Problem: Loop/pattern exercise #17.
- Difficulty: Easy
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-018
- Problem: Loop/pattern exercise #18.
- Difficulty: Easy
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-019
- Problem: Loop/pattern exercise #19.
- Difficulty: Easy
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-020
- Problem: Loop/pattern exercise #20.
- Difficulty: Easy
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-021
- Problem: Loop/pattern exercise #21.
- Difficulty: Easy
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-022
- Problem: Loop/pattern exercise #22.
- Difficulty: Easy
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-023
- Problem: Loop/pattern exercise #23.
- Difficulty: Easy
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-024
- Problem: Loop/pattern exercise #24.
- Difficulty: Easy
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-025
- Problem: Loop/pattern exercise #25.
- Difficulty: Easy
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-026
- Problem: Loop/pattern exercise #26.
- Difficulty: Easy
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-027
- Problem: Loop/pattern exercise #27.
- Difficulty: Easy
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-028
- Problem: Loop/pattern exercise #28.
- Difficulty: Easy
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-029
- Problem: Loop/pattern exercise #29.
- Difficulty: Easy
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-030
- Problem: Loop/pattern exercise #30.
- Difficulty: Easy
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-031
- Problem: Loop/pattern exercise #31.
- Difficulty: Easy
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-032
- Problem: Loop/pattern exercise #32.
- Difficulty: Easy
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-033
- Problem: Loop/pattern exercise #33.
- Difficulty: Easy
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-034
- Problem: Loop/pattern exercise #34.
- Difficulty: Easy
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-035
- Problem: Loop/pattern exercise #35.
- Difficulty: Easy
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-036
- Problem: Loop/pattern exercise #36.
- Difficulty: Easy
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-037
- Problem: Loop/pattern exercise #37.
- Difficulty: Easy
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-038
- Problem: Loop/pattern exercise #38.
- Difficulty: Easy
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-039
- Problem: Loop/pattern exercise #39.
- Difficulty: Easy
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-040
- Problem: Loop/pattern exercise #40.
- Difficulty: Easy
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-041
- Problem: Loop/pattern exercise #41.
- Difficulty: Easy
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-042
- Problem: Loop/pattern exercise #42.
- Difficulty: Easy
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-043
- Problem: Loop/pattern exercise #43.
- Difficulty: Easy
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-044
- Problem: Loop/pattern exercise #44.
- Difficulty: Easy
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-045
- Problem: Loop/pattern exercise #45.
- Difficulty: Easy
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-046
- Problem: Loop/pattern exercise #46.
- Difficulty: Easy
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-047
- Problem: Loop/pattern exercise #47.
- Difficulty: Easy
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-048
- Problem: Loop/pattern exercise #48.
- Difficulty: Easy
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-049
- Problem: Loop/pattern exercise #49.
- Difficulty: Easy
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-050
- Problem: Loop/pattern exercise #50.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-051
- Problem: Loop/pattern exercise #51.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-052
- Problem: Loop/pattern exercise #52.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-053
- Problem: Loop/pattern exercise #53.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-054
- Problem: Loop/pattern exercise #54.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-055
- Problem: Loop/pattern exercise #55.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-056
- Problem: Loop/pattern exercise #56.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-057
- Problem: Loop/pattern exercise #57.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-058
- Problem: Loop/pattern exercise #58.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-059
- Problem: Loop/pattern exercise #59.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-060
- Problem: Loop/pattern exercise #60.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-061
- Problem: Loop/pattern exercise #61.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-062
- Problem: Loop/pattern exercise #62.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-063
- Problem: Loop/pattern exercise #63.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-064
- Problem: Loop/pattern exercise #64.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-065
- Problem: Loop/pattern exercise #65.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-066
- Problem: Loop/pattern exercise #66.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-067
- Problem: Loop/pattern exercise #67.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-068
- Problem: Loop/pattern exercise #68.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-069
- Problem: Loop/pattern exercise #69.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-070
- Problem: Loop/pattern exercise #70.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-071
- Problem: Loop/pattern exercise #71.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-072
- Problem: Loop/pattern exercise #72.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-073
- Problem: Loop/pattern exercise #73.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-074
- Problem: Loop/pattern exercise #74.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-075
- Problem: Loop/pattern exercise #75.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-076
- Problem: Loop/pattern exercise #76.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-077
- Problem: Loop/pattern exercise #77.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-078
- Problem: Loop/pattern exercise #78.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-079
- Problem: Loop/pattern exercise #79.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-080
- Problem: Loop/pattern exercise #80.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-081
- Problem: Loop/pattern exercise #81.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-082
- Problem: Loop/pattern exercise #82.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-083
- Problem: Loop/pattern exercise #83.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-084
- Problem: Loop/pattern exercise #84.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-085
- Problem: Loop/pattern exercise #85.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-086
- Problem: Loop/pattern exercise #86.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-087
- Problem: Loop/pattern exercise #87.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-088
- Problem: Loop/pattern exercise #88.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-089
- Problem: Loop/pattern exercise #89.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-090
- Problem: Loop/pattern exercise #90.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-091
- Problem: Loop/pattern exercise #91.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-092
- Problem: Loop/pattern exercise #92.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-093
- Problem: Loop/pattern exercise #93.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-094
- Problem: Loop/pattern exercise #94.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-095
- Problem: Loop/pattern exercise #95.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-096
- Problem: Loop/pattern exercise #96.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-097
- Problem: Loop/pattern exercise #97.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-098
- Problem: Loop/pattern exercise #98.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-099
- Problem: Loop/pattern exercise #99.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-100
- Problem: Loop/pattern exercise #100.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-101
- Problem: Loop/pattern exercise #101.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-102
- Problem: Loop/pattern exercise #102.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-103
- Problem: Loop/pattern exercise #103.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-104
- Problem: Loop/pattern exercise #104.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-105
- Problem: Loop/pattern exercise #105.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-106
- Problem: Loop/pattern exercise #106.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-107
- Problem: Loop/pattern exercise #107.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-108
- Problem: Loop/pattern exercise #108.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-109
- Problem: Loop/pattern exercise #109.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-110
- Problem: Loop/pattern exercise #110.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-111
- Problem: Loop/pattern exercise #111.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-112
- Problem: Loop/pattern exercise #112.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-113
- Problem: Loop/pattern exercise #113.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-114
- Problem: Loop/pattern exercise #114.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-115
- Problem: Loop/pattern exercise #115.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-116
- Problem: Loop/pattern exercise #116.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-117
- Problem: Loop/pattern exercise #117.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-118
- Problem: Loop/pattern exercise #118.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-119
- Problem: Loop/pattern exercise #119.
- Difficulty: Medium
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-120
- Problem: Loop/pattern exercise #120.
- Difficulty: Hard
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-121
- Problem: Loop/pattern exercise #121.
- Difficulty: Hard
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-122
- Problem: Loop/pattern exercise #122.
- Difficulty: Hard
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-123
- Problem: Loop/pattern exercise #123.
- Difficulty: Hard
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-124
- Problem: Loop/pattern exercise #124.
- Difficulty: Hard
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-125
- Problem: Loop/pattern exercise #125.
- Difficulty: Hard
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-126
- Problem: Loop/pattern exercise #126.
- Difficulty: Hard
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-127
- Problem: Loop/pattern exercise #127.
- Difficulty: Hard
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-128
- Problem: Loop/pattern exercise #128.
- Difficulty: Hard
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-129
- Problem: Loop/pattern exercise #129.
- Difficulty: Hard
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-130
- Problem: Loop/pattern exercise #130.
- Difficulty: Hard
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-131
- Problem: Loop/pattern exercise #131.
- Difficulty: Hard
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-132
- Problem: Loop/pattern exercise #132.
- Difficulty: Hard
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-133
- Problem: Loop/pattern exercise #133.
- Difficulty: Hard
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-134
- Problem: Loop/pattern exercise #134.
- Difficulty: Hard
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-135
- Problem: Loop/pattern exercise #135.
- Difficulty: Hard
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-136
- Problem: Loop/pattern exercise #136.
- Difficulty: Hard
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-137
- Problem: Loop/pattern exercise #137.
- Difficulty: Hard
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-138
- Problem: Loop/pattern exercise #138.
- Difficulty: Hard
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-139
- Problem: Loop/pattern exercise #139.
- Difficulty: Hard
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-140
- Problem: Loop/pattern exercise #140.
- Difficulty: Hard
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-141
- Problem: Loop/pattern exercise #141.
- Difficulty: Hard
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-142
- Problem: Loop/pattern exercise #142.
- Difficulty: Hard
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-143
- Problem: Loop/pattern exercise #143.
- Difficulty: Hard
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-144
- Problem: Loop/pattern exercise #144.
- Difficulty: Hard
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-145
- Problem: Loop/pattern exercise #145.
- Difficulty: Hard
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-146
- Problem: Loop/pattern exercise #146.
- Difficulty: Hard
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-147
- Problem: Loop/pattern exercise #147.
- Difficulty: Hard
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-148
- Problem: Loop/pattern exercise #148.
- Difficulty: Hard
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-149
- Problem: Loop/pattern exercise #149.
- Difficulty: Hard
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-150
- Problem: Loop/pattern exercise #150.
- Difficulty: Hard
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-151
- Problem: Loop/pattern exercise #151.
- Difficulty: Hard
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-152
- Problem: Loop/pattern exercise #152.
- Difficulty: Hard
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-153
- Problem: Loop/pattern exercise #153.
- Difficulty: Hard
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-154
- Problem: Loop/pattern exercise #154.
- Difficulty: Hard
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-155
- Problem: Loop/pattern exercise #155.
- Difficulty: Hard
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-156
- Problem: Loop/pattern exercise #156.
- Difficulty: Hard
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-157
- Problem: Loop/pattern exercise #157.
- Difficulty: Hard
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-158
- Problem: Loop/pattern exercise #158.
- Difficulty: Hard
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-159
- Problem: Loop/pattern exercise #159.
- Difficulty: Hard
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-160
- Problem: Loop/pattern exercise #160.
- Difficulty: Hard
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-161
- Problem: Loop/pattern exercise #161.
- Difficulty: Hard
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-162
- Problem: Loop/pattern exercise #162.
- Difficulty: Hard
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-163
- Problem: Loop/pattern exercise #163.
- Difficulty: Hard
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-164
- Problem: Loop/pattern exercise #164.
- Difficulty: Hard
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-165
- Problem: Loop/pattern exercise #165.
- Difficulty: Hard
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-166
- Problem: Loop/pattern exercise #166.
- Difficulty: Hard
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-167
- Problem: Loop/pattern exercise #167.
- Difficulty: Hard
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-168
- Problem: Loop/pattern exercise #168.
- Difficulty: Hard
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-169
- Problem: Loop/pattern exercise #169.
- Difficulty: Hard
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-170
- Problem: Loop/pattern exercise #170.
- Difficulty: Hard
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-171
- Problem: Loop/pattern exercise #171.
- Difficulty: Hard
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-172
- Problem: Loop/pattern exercise #172.
- Difficulty: Hard
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.
EX-173
- Problem: Loop/pattern exercise #173.
- Difficulty: Hard
- Skills: Loop selection, nested loop control, pattern derivation.
- Implementation: Write in both JavaScript and C++.
- Verify: Compare output against expected pattern.