Episode 7 — DSA with JavaScript / 7.1 — Conditional Statements
7.1 — Exercise Questions: Conditional Statements
Easy
E1. Even or Odd
Write a function that returns "even" or "odd" for a given integer.
Hint: Use modulo operator %.
Solution (JS)
function evenOrOdd(n) {
return n % 2 === 0 ? "even" : "odd";
}
console.log(evenOrOdd(4)); // "even"
console.log(evenOrOdd(7)); // "odd"
console.log(evenOrOdd(0)); // "even"
console.log(evenOrOdd(-3)); // "odd"
Solution (C++)
#include <iostream>
#include <string>
using namespace std;
string evenOrOdd(int n) {
return n % 2 == 0 ? "even" : "odd";
}
int main() {
cout << evenOrOdd(4) << endl; // even
cout << evenOrOdd(7) << endl; // odd
cout << evenOrOdd(-3) << endl; // odd
return 0;
}
Complexity: O(1) time, O(1) space.
E2. Maximum of Three Numbers
Write a function that returns the maximum of three numbers.
Hint: Compare pairs or use nested ternaries.
Solution (JS)
function maxOfThree(a, b, c) {
if (a >= b && a >= c) return a;
if (b >= c) return b;
return c;
}
// Or simply: Math.max(a, b, c)
console.log(maxOfThree(3, 7, 2)); // 7
console.log(maxOfThree(5, 5, 5)); // 5
Solution (C++)
int maxOfThree(int a, int b, int c) {
if (a >= b && a >= c) return a;
if (b >= c) return b;
return c;
}
E3. Leap Year
Write a function that returns true if a year is a leap year.
Rules:
- Divisible by 4 → potential leap
- Divisible by 100 → NOT leap (unless...)
- Divisible by 400 → YES leap
Solution (JS)
function isLeapYear(year) {
return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
}
console.log(isLeapYear(2024)); // true
console.log(isLeapYear(1900)); // false
console.log(isLeapYear(2000)); // true
console.log(isLeapYear(2023)); // false
Solution (C++)
bool isLeapYear(int year) {
return (year % 4 == 0 && year % 100 != 0) || year % 400 == 0;
}
E4. Grade Calculator
Given a score (0-100), return the letter grade.
| Score | Grade |
|---|---|
| 90-100 | A |
| 80-89 | B |
| 70-79 | C |
| 60-69 | D |
| 0-59 | F |
Solution (JS)
function getGrade(score) {
if (score < 0 || score > 100) return "Invalid";
if (score >= 90) return "A";
if (score >= 80) return "B";
if (score >= 70) return "C";
if (score >= 60) return "D";
return "F";
}
E5. FizzBuzz
For numbers 1 to n, return "Fizz" for multiples of 3, "Buzz" for multiples of 5, "FizzBuzz" for both, or the number as a string.
Solution (JS)
function fizzBuzz(n) {
const result = [];
for (let i = 1; i <= n; i++) {
if (i % 15 === 0) result.push("FizzBuzz");
else if (i % 3 === 0) result.push("Fizz");
else if (i % 5 === 0) result.push("Buzz");
else result.push(String(i));
}
return result;
}
console.log(fizzBuzz(15));
// ["1","2","Fizz","4","Buzz","Fizz","7","8","Fizz","Buzz","11","Fizz","13","14","FizzBuzz"]
Solution (C++)
#include <iostream>
#include <string>
#include <vector>
using namespace std;
vector<string> fizzBuzz(int n) {
vector<string> result;
for (int i = 1; i <= n; i++) {
if (i % 15 == 0) result.push_back("FizzBuzz");
else if (i % 3 == 0) result.push_back("Fizz");
else if (i % 5 == 0) result.push_back("Buzz");
else result.push_back(to_string(i));
}
return result;
}
Medium
E6. Day of the Week
Given a number 1-7, return the day name using a switch statement.
Solution (JS)
function dayName(n) {
switch (n) {
case 1: return "Monday";
case 2: return "Tuesday";
case 3: return "Wednesday";
case 4: return "Thursday";
case 5: return "Friday";
case 6: return "Saturday";
case 7: return "Sunday";
default: return "Invalid day";
}
}
E7. Simple Calculator
Build a calculator that takes two numbers and an operator (+, -, *, /) and returns the result. Handle division by zero.
Solution (JS)
function calculate(a, op, b) {
switch (op) {
case "+": return a + b;
case "-": return a - b;
case "*": return a * b;
case "/":
if (b === 0) return "Error: Division by zero";
return a / b;
default:
return "Error: Unknown operator";
}
}
Solution (C++)
#include <string>
#include <stdexcept>
using namespace std;
double calculate(double a, char op, double b) {
switch (op) {
case '+': return a + b;
case '-': return a - b;
case '*': return a * b;
case '/':
if (b == 0) throw runtime_error("Division by zero");
return a / b;
default:
throw runtime_error("Unknown operator");
}
}
E8. Number to Words (1-20)
Convert an integer 1-20 to its English word.
Solution (JS)
function numberToWord(n) {
const words = [
"", "one", "two", "three", "four", "five",
"six", "seven", "eight", "nine", "ten",
"eleven", "twelve", "thirteen", "fourteen", "fifteen",
"sixteen", "seventeen", "eighteen", "nineteen", "twenty"
];
if (n < 1 || n > 20) return "out of range";
return words[n];
}
E9. Rock Paper Scissors
Given two player choices, determine the winner.
Solution (JS)
function rps(p1, p2) {
if (p1 === p2) return "Draw";
const wins = { rock: "scissors", scissors: "paper", paper: "rock" };
if (wins[p1] === p2) return "Player 1 wins";
return "Player 2 wins";
}
console.log(rps("rock", "scissors")); // "Player 1 wins"
console.log(rps("paper", "paper")); // "Draw"
E10. Password Strength Checker
Check if a password meets all requirements: min 8 chars, has uppercase, has lowercase, has digit, has special character.
Solution (JS)
function passwordStrength(pw) {
const checks = {
length: pw.length >= 8,
uppercase: /[A-Z]/.test(pw),
lowercase: /[a-z]/.test(pw),
digit: /\d/.test(pw),
special: /[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>?]/.test(pw),
};
const passed = Object.values(checks).filter(Boolean).length;
if (passed === 5) return "Strong";
if (passed >= 3) return "Medium";
return "Weak";
}
Hard
E11. Roman Numeral Converter (1-3999)
Convert an integer to a Roman numeral string.
Solution (JS)
function toRoman(num) {
const values = [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1];
const symbols = ["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"];
let result = "";
for (let i = 0; i < values.length; i++) {
while (num >= values[i]) {
result += symbols[i];
num -= values[i];
}
}
return result;
}
console.log(toRoman(1994)); // "MCMXCIV"
console.log(toRoman(58)); // "LVIII"
Solution (C++)
#include <string>
#include <vector>
using namespace std;
string toRoman(int num) {
vector<int> values = {1000,900,500,400,100,90,50,40,10,9,5,4,1};
vector<string> symbols = {"M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"};
string result;
for (int i = 0; i < values.size(); i++) {
while (num >= values[i]) {
result += symbols[i];
num -= values[i];
}
}
return result;
}
Complexity: O(1) — bounded by 3999 max value.
E12. Validate a Date
Given day, month, year, determine if the date is valid. Account for leap years and month-specific day limits.
Solution (JS)
function isValidDate(day, month, year) {
if (year < 1 || month < 1 || month > 12 || day < 1) return false;
const daysInMonth = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
if ((year % 4 === 0 && year % 100 !== 0) || year % 400 === 0) {
daysInMonth[2] = 29;
}
return day <= daysInMonth[month];
}
console.log(isValidDate(29, 2, 2024)); // true (leap year)
console.log(isValidDate(29, 2, 2023)); // false
console.log(isValidDate(31, 4, 2024)); // false (April has 30)
Solution (C++)
bool isValidDate(int day, int month, int year) {
if (year < 1 || month < 1 || month > 12 || day < 1) return false;
int daysInMonth[] = {0,31,28,31,30,31,30,31,31,30,31,30,31};
if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0)
daysInMonth[2] = 29;
return day <= daysInMonth[month];
}
E13. Tax Calculator with Progressive Brackets
Income Tax Rate
0 - 10,000 0%
10,001 - 40,000 12%
40,001 - 80,000 22%
80,001+ 32%
Calculate the total tax (not flat rate — progressive brackets).
Solution (JS)
function calculateTax(income) {
if (income <= 0) return 0;
let tax = 0;
const brackets = [
{ limit: 10000, rate: 0 },
{ limit: 40000, rate: 0.12 },
{ limit: 80000, rate: 0.22 },
{ limit: Infinity, rate: 0.32 },
];
let prev = 0;
for (const { limit, rate } of brackets) {
if (income <= prev) break;
const taxable = Math.min(income, limit) - prev;
tax += taxable * rate;
prev = limit;
}
return Math.round(tax * 100) / 100;
}
console.log(calculateTax(50000));
// 0*10000 + 0.12*30000 + 0.22*10000 = 0 + 3600 + 2200 = 5800
Solution (C++)
#include <vector>
#include <algorithm>
#include <climits>
using namespace std;
double calculateTax(double income) {
if (income <= 0) return 0;
struct Bracket { double limit; double rate; };
vector<Bracket> brackets = {
{10000, 0}, {40000, 0.12}, {80000, 0.22}, {1e18, 0.32}
};
double tax = 0, prev = 0;
for (auto& b : brackets) {
if (income <= prev) break;
double taxable = min(income, b.limit) - prev;
tax += taxable * b.rate;
prev = b.limit;
}
return tax;
}
E14. Implement a Mini Rule Engine
Given a list of rules (conditions + actions), evaluate them against an object.
Solution (JS)
function evaluateRules(data, rules) {
const results = [];
for (const rule of rules) {
if (rule.condition(data)) {
results.push({ rule: rule.name, action: rule.action(data) });
}
}
return results;
}
const rules = [
{
name: "High temperature alert",
condition: (d) => d.temp > 40,
action: () => "ALERT: Temperature critical!",
},
{
name: "Low battery",
condition: (d) => d.battery < 20,
action: (d) => `Battery at ${d.battery}%`,
},
];
console.log(evaluateRules({ temp: 45, battery: 15 }, rules));
// Both rules fire
E15. Vending Machine State Machine
Implement a vending machine with states: IDLE, COIN_INSERTED, ITEM_SELECTED, DISPENSING. Handle events: INSERT_COIN, SELECT_ITEM, DISPENSE, CANCEL.
Solution (JS)
function vendingMachine(state, event) {
switch (state) {
case "IDLE":
if (event === "INSERT_COIN") return "COIN_INSERTED";
return state;
case "COIN_INSERTED":
if (event === "SELECT_ITEM") return "ITEM_SELECTED";
if (event === "CANCEL") return "IDLE";
return state;
case "ITEM_SELECTED":
if (event === "DISPENSE") return "DISPENSING";
if (event === "CANCEL") return "IDLE";
return state;
case "DISPENSING":
if (event === "COMPLETE") return "IDLE";
return state;
default:
return "IDLE";
}
}
Additional exercise bank
E16. Check if a character is a vowel or consonant
Write a function that handles this scenario with proper input validation and edge case handling. Implement in both JS and C++.
- Difficulty: Easy
- Approach: Identify the conditions, handle edge cases first, then implement the logic.
- Test cases: Normal input, boundary values, invalid input.
E17. Convert Celsius to Fahrenheit with range validation
Write a function that handles this scenario with proper input validation and edge case handling. Implement in both JS and C++.
- Difficulty: Easy
- Approach: Identify the conditions, handle edge cases first, then implement the logic.
- Test cases: Normal input, boundary values, invalid input.
E18. Determine the quadrant of a point
Write a function that handles this scenario with proper input validation and edge case handling. Implement in both JS and C++.
- Difficulty: Easy
- Approach: Identify the conditions, handle edge cases first, then implement the logic.
- Test cases: Normal input, boundary values, invalid input.
E19. Check if three numbers can form a valid triangle
Write a function that handles this scenario with proper input validation and edge case handling. Implement in both JS and C++.
- Difficulty: Easy
- Approach: Identify the conditions, handle edge cases first, then implement the logic.
- Test cases: Normal input, boundary values, invalid input.
E20. Return the ordinal suffix for a number (st, nd, rd, th)
Write a function that handles this scenario with proper input validation and edge case handling. Implement in both JS and C++.
- Difficulty: Easy
- Approach: Identify the conditions, handle edge cases first, then implement the logic.
- Test cases: Normal input, boundary values, invalid input.
E21. Classify a character as uppercase, lowercase, digit, or special
Write a function that handles this scenario with proper input validation and edge case handling. Implement in both JS and C++.
- Difficulty: Easy
- Approach: Identify the conditions, handle edge cases first, then implement the logic.
- Test cases: Normal input, boundary values, invalid input.
E22. Check if a number is prime (basic approach)
Write a function that handles this scenario with proper input validation and edge case handling. Implement in both JS and C++.
- Difficulty: Easy
- Approach: Identify the conditions, handle edge cases first, then implement the logic.
- Test cases: Normal input, boundary values, invalid input.
E23. Return the number of days in a given month and year
Write a function that handles this scenario with proper input validation and edge case handling. Implement in both JS and C++.
- Difficulty: Easy
- Approach: Identify the conditions, handle edge cases first, then implement the logic.
- Test cases: Normal input, boundary values, invalid input.
E24. Implement a basic traffic light state machine
Write a function that handles this scenario with proper input validation and edge case handling. Implement in both JS and C++.
- Difficulty: Medium
- Approach: Identify the conditions, handle edge cases first, then implement the logic.
- Test cases: Normal input, boundary values, invalid input.
E25. Validate an IP address (basic — 4 parts, each 0-255)
Write a function that handles this scenario with proper input validation and edge case handling. Implement in both JS and C++.
- Difficulty: Medium
- Approach: Identify the conditions, handle edge cases first, then implement the logic.
- Test cases: Normal input, boundary values, invalid input.
E26. Calculate BMI and classify the result
Write a function that handles this scenario with proper input validation and edge case handling. Implement in both JS and C++.
- Difficulty: Medium
- Approach: Identify the conditions, handle edge cases first, then implement the logic.
- Test cases: Normal input, boundary values, invalid input.
E27. Determine shipping cost based on weight and destination tier
Write a function that handles this scenario with proper input validation and edge case handling. Implement in both JS and C++.
- Difficulty: Medium
- Approach: Identify the conditions, handle edge cases first, then implement the logic.
- Test cases: Normal input, boundary values, invalid input.
E28. Check if a year is a century year
Write a function that handles this scenario with proper input validation and edge case handling. Implement in both JS and C++.
- Difficulty: Medium
- Approach: Identify the conditions, handle edge cases first, then implement the logic.
- Test cases: Normal input, boundary values, invalid input.
E29. Implement a simple scoring system for a quiz
Write a function that handles this scenario with proper input validation and edge case handling. Implement in both JS and C++.
- Difficulty: Medium
- Approach: Identify the conditions, handle edge cases first, then implement the logic.
- Test cases: Normal input, boundary values, invalid input.
E30. Determine if a given time is AM or PM from 24h format
Write a function that handles this scenario with proper input validation and edge case handling. Implement in both JS and C++.
- Difficulty: Medium
- Approach: Identify the conditions, handle edge cases first, then implement the logic.
- Test cases: Normal input, boundary values, invalid input.
E31. Check if two intervals overlap
Write a function that handles this scenario with proper input validation and edge case handling. Implement in both JS and C++.
- Difficulty: Medium
- Approach: Identify the conditions, handle edge cases first, then implement the logic.
- Test cases: Normal input, boundary values, invalid input.
E32. Validate a password against a set of rules
Write a function that handles this scenario with proper input validation and edge case handling. Implement in both JS and C++.
- Difficulty: Medium
- Approach: Identify the conditions, handle edge cases first, then implement the logic.
- Test cases: Normal input, boundary values, invalid input.
E33. Implement a basic calculator with memory operations
Write a function that handles this scenario with proper input validation and edge case handling. Implement in both JS and C++.
- Difficulty: Medium
- Approach: Identify the conditions, handle edge cases first, then implement the logic.
- Test cases: Normal input, boundary values, invalid input.
E34. Determine the season from a month number
Write a function that handles this scenario with proper input validation and edge case handling. Implement in both JS and C++.
- Difficulty: Hard
- Approach: Identify the conditions, handle edge cases first, then implement the logic.
- Test cases: Normal input, boundary values, invalid input.
E35. Check if a matrix position is valid
Write a function that handles this scenario with proper input validation and edge case handling. Implement in both JS and C++.
- Difficulty: Hard
- Approach: Identify the conditions, handle edge cases first, then implement the logic.
- Test cases: Normal input, boundary values, invalid input.
E36. Convert a number grade to a letter grade with +/- modifiers
Write a function that handles this scenario with proper input validation and edge case handling. Implement in both JS and C++.
- Difficulty: Hard
- Approach: Identify the conditions, handle edge cases first, then implement the logic.
- Test cases: Normal input, boundary values, invalid input.
E37. Implement a simple ATM withdrawal validator
Write a function that handles this scenario with proper input validation and edge case handling. Implement in both JS and C++.
- Difficulty: Hard
- Approach: Identify the conditions, handle edge cases first, then implement the logic.
- Test cases: Normal input, boundary values, invalid input.
E38. Check if three points are collinear
Write a function that handles this scenario with proper input validation and edge case handling. Implement in both JS and C++.
- Difficulty: Hard
- Approach: Identify the conditions, handle edge cases first, then implement the logic.
- Test cases: Normal input, boundary values, invalid input.
E39. Determine the type of quadrilateral from side lengths and angles
Write a function that handles this scenario with proper input validation and edge case handling. Implement in both JS and C++.
- Difficulty: Hard
- Approach: Identify the conditions, handle edge cases first, then implement the logic.
- Test cases: Normal input, boundary values, invalid input.
E40. Implement a basic spell checker (known word list + conditionals)
Write a function that handles this scenario with proper input validation and edge case handling. Implement in both JS and C++.
- Difficulty: Hard
- Approach: Identify the conditions, handle edge cases first, then implement the logic.
- Test cases: Normal input, boundary values, invalid input.
EX-041
- Problem: Conditional logic exercise #41 — apply appropriate conditional patterns.
- Difficulty: Easy
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-042
- Problem: Conditional logic exercise #42 — apply appropriate conditional patterns.
- Difficulty: Easy
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-043
- Problem: Conditional logic exercise #43 — apply appropriate conditional patterns.
- Difficulty: Easy
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-044
- Problem: Conditional logic exercise #44 — apply appropriate conditional patterns.
- Difficulty: Easy
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-045
- Problem: Conditional logic exercise #45 — apply appropriate conditional patterns.
- Difficulty: Easy
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-046
- Problem: Conditional logic exercise #46 — apply appropriate conditional patterns.
- Difficulty: Easy
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-047
- Problem: Conditional logic exercise #47 — apply appropriate conditional patterns.
- Difficulty: Easy
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-048
- Problem: Conditional logic exercise #48 — apply appropriate conditional patterns.
- Difficulty: Easy
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-049
- Problem: Conditional logic exercise #49 — apply appropriate conditional patterns.
- Difficulty: Easy
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-050
- Problem: Conditional logic exercise #50 — apply appropriate conditional patterns.
- Difficulty: Easy
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-051
- Problem: Conditional logic exercise #51 — apply appropriate conditional patterns.
- Difficulty: Easy
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-052
- Problem: Conditional logic exercise #52 — apply appropriate conditional patterns.
- Difficulty: Easy
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-053
- Problem: Conditional logic exercise #53 — apply appropriate conditional patterns.
- Difficulty: Easy
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-054
- Problem: Conditional logic exercise #54 — apply appropriate conditional patterns.
- Difficulty: Easy
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-055
- Problem: Conditional logic exercise #55 — apply appropriate conditional patterns.
- Difficulty: Easy
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-056
- Problem: Conditional logic exercise #56 — apply appropriate conditional patterns.
- Difficulty: Easy
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-057
- Problem: Conditional logic exercise #57 — apply appropriate conditional patterns.
- Difficulty: Easy
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-058
- Problem: Conditional logic exercise #58 — apply appropriate conditional patterns.
- Difficulty: Easy
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-059
- Problem: Conditional logic exercise #59 — apply appropriate conditional patterns.
- Difficulty: Easy
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-060
- Problem: Conditional logic exercise #60 — apply appropriate conditional patterns.
- Difficulty: Easy
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-061
- Problem: Conditional logic exercise #61 — apply appropriate conditional patterns.
- Difficulty: Easy
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-062
- Problem: Conditional logic exercise #62 — apply appropriate conditional patterns.
- Difficulty: Easy
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-063
- Problem: Conditional logic exercise #63 — apply appropriate conditional patterns.
- Difficulty: Easy
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-064
- Problem: Conditional logic exercise #64 — apply appropriate conditional patterns.
- Difficulty: Easy
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-065
- Problem: Conditional logic exercise #65 — apply appropriate conditional patterns.
- Difficulty: Easy
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-066
- Problem: Conditional logic exercise #66 — apply appropriate conditional patterns.
- Difficulty: Easy
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-067
- Problem: Conditional logic exercise #67 — apply appropriate conditional patterns.
- Difficulty: Easy
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-068
- Problem: Conditional logic exercise #68 — apply appropriate conditional patterns.
- Difficulty: Easy
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-069
- Problem: Conditional logic exercise #69 — apply appropriate conditional patterns.
- Difficulty: Easy
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-070
- Problem: Conditional logic exercise #70 — apply appropriate conditional patterns.
- Difficulty: Easy
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-071
- Problem: Conditional logic exercise #71 — apply appropriate conditional patterns.
- Difficulty: Easy
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-072
- Problem: Conditional logic exercise #72 — apply appropriate conditional patterns.
- Difficulty: Easy
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-073
- Problem: Conditional logic exercise #73 — apply appropriate conditional patterns.
- Difficulty: Easy
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-074
- Problem: Conditional logic exercise #74 — apply appropriate conditional patterns.
- Difficulty: Easy
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-075
- Problem: Conditional logic exercise #75 — apply appropriate conditional patterns.
- Difficulty: Easy
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-076
- Problem: Conditional logic exercise #76 — apply appropriate conditional patterns.
- Difficulty: Easy
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-077
- Problem: Conditional logic exercise #77 — apply appropriate conditional patterns.
- Difficulty: Easy
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-078
- Problem: Conditional logic exercise #78 — apply appropriate conditional patterns.
- Difficulty: Easy
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-079
- Problem: Conditional logic exercise #79 — apply appropriate conditional patterns.
- Difficulty: Easy
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-080
- Problem: Conditional logic exercise #80 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-081
- Problem: Conditional logic exercise #81 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-082
- Problem: Conditional logic exercise #82 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-083
- Problem: Conditional logic exercise #83 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-084
- Problem: Conditional logic exercise #84 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-085
- Problem: Conditional logic exercise #85 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-086
- Problem: Conditional logic exercise #86 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-087
- Problem: Conditional logic exercise #87 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-088
- Problem: Conditional logic exercise #88 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-089
- Problem: Conditional logic exercise #89 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-090
- Problem: Conditional logic exercise #90 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-091
- Problem: Conditional logic exercise #91 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-092
- Problem: Conditional logic exercise #92 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-093
- Problem: Conditional logic exercise #93 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-094
- Problem: Conditional logic exercise #94 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-095
- Problem: Conditional logic exercise #95 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-096
- Problem: Conditional logic exercise #96 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-097
- Problem: Conditional logic exercise #97 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-098
- Problem: Conditional logic exercise #98 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-099
- Problem: Conditional logic exercise #99 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-100
- Problem: Conditional logic exercise #100 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-101
- Problem: Conditional logic exercise #101 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-102
- Problem: Conditional logic exercise #102 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-103
- Problem: Conditional logic exercise #103 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-104
- Problem: Conditional logic exercise #104 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-105
- Problem: Conditional logic exercise #105 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-106
- Problem: Conditional logic exercise #106 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-107
- Problem: Conditional logic exercise #107 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-108
- Problem: Conditional logic exercise #108 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-109
- Problem: Conditional logic exercise #109 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-110
- Problem: Conditional logic exercise #110 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-111
- Problem: Conditional logic exercise #111 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-112
- Problem: Conditional logic exercise #112 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-113
- Problem: Conditional logic exercise #113 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-114
- Problem: Conditional logic exercise #114 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-115
- Problem: Conditional logic exercise #115 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-116
- Problem: Conditional logic exercise #116 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-117
- Problem: Conditional logic exercise #117 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-118
- Problem: Conditional logic exercise #118 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-119
- Problem: Conditional logic exercise #119 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-120
- Problem: Conditional logic exercise #120 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-121
- Problem: Conditional logic exercise #121 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-122
- Problem: Conditional logic exercise #122 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-123
- Problem: Conditional logic exercise #123 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-124
- Problem: Conditional logic exercise #124 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-125
- Problem: Conditional logic exercise #125 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-126
- Problem: Conditional logic exercise #126 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-127
- Problem: Conditional logic exercise #127 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-128
- Problem: Conditional logic exercise #128 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-129
- Problem: Conditional logic exercise #129 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-130
- Problem: Conditional logic exercise #130 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-131
- Problem: Conditional logic exercise #131 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-132
- Problem: Conditional logic exercise #132 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-133
- Problem: Conditional logic exercise #133 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-134
- Problem: Conditional logic exercise #134 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-135
- Problem: Conditional logic exercise #135 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-136
- Problem: Conditional logic exercise #136 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-137
- Problem: Conditional logic exercise #137 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-138
- Problem: Conditional logic exercise #138 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-139
- Problem: Conditional logic exercise #139 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-140
- Problem: Conditional logic exercise #140 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-141
- Problem: Conditional logic exercise #141 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-142
- Problem: Conditional logic exercise #142 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-143
- Problem: Conditional logic exercise #143 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-144
- Problem: Conditional logic exercise #144 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-145
- Problem: Conditional logic exercise #145 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-146
- Problem: Conditional logic exercise #146 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-147
- Problem: Conditional logic exercise #147 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-148
- Problem: Conditional logic exercise #148 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-149
- Problem: Conditional logic exercise #149 — apply appropriate conditional patterns.
- Difficulty: Medium
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-150
- Problem: Conditional logic exercise #150 — apply appropriate conditional patterns.
- Difficulty: Hard
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-151
- Problem: Conditional logic exercise #151 — apply appropriate conditional patterns.
- Difficulty: Hard
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-152
- Problem: Conditional logic exercise #152 — apply appropriate conditional patterns.
- Difficulty: Hard
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-153
- Problem: Conditional logic exercise #153 — apply appropriate conditional patterns.
- Difficulty: Hard
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-154
- Problem: Conditional logic exercise #154 — apply appropriate conditional patterns.
- Difficulty: Hard
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-155
- Problem: Conditional logic exercise #155 — apply appropriate conditional patterns.
- Difficulty: Hard
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-156
- Problem: Conditional logic exercise #156 — apply appropriate conditional patterns.
- Difficulty: Hard
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-157
- Problem: Conditional logic exercise #157 — apply appropriate conditional patterns.
- Difficulty: Hard
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-158
- Problem: Conditional logic exercise #158 — apply appropriate conditional patterns.
- Difficulty: Hard
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-159
- Problem: Conditional logic exercise #159 — apply appropriate conditional patterns.
- Difficulty: Hard
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-160
- Problem: Conditional logic exercise #160 — apply appropriate conditional patterns.
- Difficulty: Hard
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-161
- Problem: Conditional logic exercise #161 — apply appropriate conditional patterns.
- Difficulty: Hard
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-162
- Problem: Conditional logic exercise #162 — apply appropriate conditional patterns.
- Difficulty: Hard
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-163
- Problem: Conditional logic exercise #163 — apply appropriate conditional patterns.
- Difficulty: Hard
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-164
- Problem: Conditional logic exercise #164 — apply appropriate conditional patterns.
- Difficulty: Hard
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-165
- Problem: Conditional logic exercise #165 — apply appropriate conditional patterns.
- Difficulty: Hard
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-166
- Problem: Conditional logic exercise #166 — apply appropriate conditional patterns.
- Difficulty: Hard
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-167
- Problem: Conditional logic exercise #167 — apply appropriate conditional patterns.
- Difficulty: Hard
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-168
- Problem: Conditional logic exercise #168 — apply appropriate conditional patterns.
- Difficulty: Hard
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-169
- Problem: Conditional logic exercise #169 — apply appropriate conditional patterns.
- Difficulty: Hard
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-170
- Problem: Conditional logic exercise #170 — apply appropriate conditional patterns.
- Difficulty: Hard
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-171
- Problem: Conditional logic exercise #171 — apply appropriate conditional patterns.
- Difficulty: Hard
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-172
- Problem: Conditional logic exercise #172 — apply appropriate conditional patterns.
- Difficulty: Hard
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-173
- Problem: Conditional logic exercise #173 — apply appropriate conditional patterns.
- Difficulty: Hard
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-174
- Problem: Conditional logic exercise #174 — apply appropriate conditional patterns.
- Difficulty: Hard
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-175
- Problem: Conditional logic exercise #175 — apply appropriate conditional patterns.
- Difficulty: Hard
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-176
- Problem: Conditional logic exercise #176 — apply appropriate conditional patterns.
- Difficulty: Hard
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-177
- Problem: Conditional logic exercise #177 — apply appropriate conditional patterns.
- Difficulty: Hard
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-178
- Problem: Conditional logic exercise #178 — apply appropriate conditional patterns.
- Difficulty: Hard
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-179
- Problem: Conditional logic exercise #179 — apply appropriate conditional patterns.
- Difficulty: Hard
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-180
- Problem: Conditional logic exercise #180 — apply appropriate conditional patterns.
- Difficulty: Hard
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-181
- Problem: Conditional logic exercise #181 — apply appropriate conditional patterns.
- Difficulty: Hard
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-182
- Problem: Conditional logic exercise #182 — apply appropriate conditional patterns.
- Difficulty: Hard
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-183
- Problem: Conditional logic exercise #183 — apply appropriate conditional patterns.
- Difficulty: Hard
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-184
- Problem: Conditional logic exercise #184 — apply appropriate conditional patterns.
- Difficulty: Hard
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-185
- Problem: Conditional logic exercise #185 — apply appropriate conditional patterns.
- Difficulty: Hard
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-186
- Problem: Conditional logic exercise #186 — apply appropriate conditional patterns.
- Difficulty: Hard
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-187
- Problem: Conditional logic exercise #187 — apply appropriate conditional patterns.
- Difficulty: Hard
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-188
- Problem: Conditional logic exercise #188 — apply appropriate conditional patterns.
- Difficulty: Hard
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-189
- Problem: Conditional logic exercise #189 — apply appropriate conditional patterns.
- Difficulty: Hard
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.
EX-190
- Problem: Conditional logic exercise #190 — apply appropriate conditional patterns.
- Difficulty: Hard
- Skills tested: if-else, switch, ternary, logical operators, guard clauses.
- Implementation: Write solution in both JavaScript and C++.
- Verify: Test with at least 3 edge cases.