Episode 7 — DSA with JavaScript / 7.4 — Object Oriented Programming
7.4.a — Classes, Objects, Constructor & this
What is Object-Oriented Programming?
OOP organises code around objects — bundles of related data (properties) and behaviour (methods). The four pillars are:
OOP Pillars
├── Encapsulation — bundle data + methods, hide internals
├── Abstraction — expose only what's necessary
├── Inheritance — child class inherits from parent
└── Polymorphism — same interface, different behaviour
Classes & Objects
A class is a blueprint; an object is an instance created from that blueprint.
Class: Car Object: myCar
┌──────────────┐ ┌──────────────────┐
│ brand │ │ brand: "Toyota" │
│ speed │ ──new──▶ │ speed: 0 │
│ accelerate() │ │ accelerate() │
└──────────────┘ └──────────────────┘
JavaScript
class Car {
constructor(brand) {
this.brand = brand;
this.speed = 0;
}
accelerate(amount) {
this.speed += amount;
return this.speed;
}
brake(amount) {
this.speed = Math.max(0, this.speed - amount);
return this.speed;
}
toString() {
return `${this.brand} going ${this.speed} km/h`;
}
}
const myCar = new Car("Toyota");
myCar.accelerate(60); // 60
myCar.brake(20); // 40
console.log(myCar.toString()); // "Toyota going 40 km/h"
C++
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
class Car {
public:
string brand;
int speed;
Car(const string& b) : brand(b), speed(0) {}
int accelerate(int amount) {
speed += amount;
return speed;
}
int brake(int amount) {
speed = max(0, speed - amount);
return speed;
}
string toString() const {
return brand + " going " + to_string(speed) + " km/h";
}
};
int main() {
Car myCar("Toyota");
myCar.accelerate(60);
myCar.brake(20);
cout << myCar.toString() << endl;
return 0;
}
The constructor
The constructor runs once when new ClassName() is called. It initialises
the object's state.
class User {
constructor(name, email) {
this.name = name;
this.email = email;
this.createdAt = new Date();
}
}
const u = new User("Alice", "alice@example.com");
console.log(u.name); // "Alice"
console.log(u.createdAt); // current date
class User {
public:
string name, email;
User(const string& n, const string& e) : name(n), email(e) {}
};
Default parameters
class Config {
constructor(host = "localhost", port = 3000) {
this.host = host;
this.port = port;
}
}
const c1 = new Config(); // localhost:3000
const c2 = new Config("api.com", 8080); // api.com:8080
The this keyword
this refers to the current object — the instance the method is called on.
┌───────────────────────────────────┐
│ Object: alice │
│ this.name = "Alice" │
│ this.greet() → "Hi, I'm Alice" │
│ ▲ │
│ └── this points here │
└───────────────────────────────────┘
Common this pitfall in JS — losing context
class Timer {
constructor() {
this.seconds = 0;
}
start() {
// BUG: `this` is lost in setInterval callback
setInterval(function() {
this.seconds++; // `this` is undefined or window!
}, 1000);
}
startFixed() {
// FIX 1: arrow function (inherits `this`)
setInterval(() => {
this.seconds++;
}, 1000);
}
}
this in C++
In C++, this is a pointer to the current object:
class Counter {
int count;
public:
Counter() : count(0) {}
Counter& increment() {
this->count++;
return *this; // method chaining
}
int getCount() const { return this->count; }
};
int main() {
Counter c;
c.increment().increment().increment();
cout << c.getCount() << endl; // 3
}
Inheritance
A child class extends a parent, inheriting its properties and methods.
┌───────────┐
│ Animal │ (parent / base)
│ name │
│ speak() │
└─────┬─────┘
│ extends
┌───────┴───────┐
│ │
┌───────┐ ┌───────┐
│ Dog │ │ Cat │ (children / derived)
│ bark()│ │ purr()│
└───────┘ └───────┘
JavaScript
class Animal {
constructor(name) {
this.name = name;
}
speak() {
return `${this.name} makes a sound`;
}
}
class Dog extends Animal {
constructor(name, breed) {
super(name); // call parent constructor
this.breed = breed;
}
speak() {
return `${this.name} barks!`; // override
}
fetch() {
return `${this.name} fetches the ball`;
}
}
const d = new Dog("Rex", "Labrador");
console.log(d.speak()); // "Rex barks!"
console.log(d.fetch()); // "Rex fetches the ball"
console.log(d instanceof Animal); // true
C++
class Animal {
public:
string name;
Animal(const string& n) : name(n) {}
virtual string speak() const {
return name + " makes a sound";
}
virtual ~Animal() = default;
};
class Dog : public Animal {
public:
string breed;
Dog(const string& n, const string& b) : Animal(n), breed(b) {}
string speak() const override {
return name + " barks!";
}
string fetch() const {
return name + " fetches the ball";
}
};
Encapsulation — Private fields
JavaScript (# prefix)
class BankAccount {
#balance;
constructor(initialBalance) {
this.#balance = initialBalance;
}
deposit(amount) {
if (amount <= 0) throw new Error("Amount must be positive");
this.#balance += amount;
}
withdraw(amount) {
if (amount > this.#balance) throw new Error("Insufficient funds");
this.#balance -= amount;
}
getBalance() {
return this.#balance;
}
}
const acc = new BankAccount(100);
acc.deposit(50);
// acc.#balance; // SyntaxError — private!
console.log(acc.getBalance()); // 150
C++ (private keyword)
class BankAccount {
private:
double balance;
public:
BankAccount(double initial) : balance(initial) {}
void deposit(double amount) {
if (amount <= 0) throw runtime_error("Amount must be positive");
balance += amount;
}
void withdraw(double amount) {
if (amount > balance) throw runtime_error("Insufficient funds");
balance -= amount;
}
double getBalance() const { return balance; }
};
Static methods and properties
Static members belong to the class itself, not instances.
class MathUtils {
static PI = 3.14159;
static circleArea(radius) {
return MathUtils.PI * radius * radius;
}
static factorial(n) {
if (n <= 1) return 1;
return n * MathUtils.factorial(n - 1);
}
}
console.log(MathUtils.PI); // 3.14159
console.log(MathUtils.circleArea(5)); // 78.539...
console.log(MathUtils.factorial(5)); // 120
class MathUtils {
public:
static constexpr double PI = 3.14159;
static double circleArea(double radius) {
return PI * radius * radius;
}
static int factorial(int n) {
if (n <= 1) return 1;
return n * factorial(n - 1);
}
};
Polymorphism
Same method name, different behavior based on the object type.
class Shape {
area() { return 0; }
}
class Circle extends Shape {
constructor(r) { super(); this.r = r; }
area() { return Math.PI * this.r ** 2; }
}
class Rectangle extends Shape {
constructor(w, h) { super(); this.w = w; this.h = h; }
area() { return this.w * this.h; }
}
const shapes = [new Circle(5), new Rectangle(4, 6)];
for (const s of shapes) {
console.log(s.area()); // 78.53..., 24
}
class Shape {
public:
virtual double area() const { return 0; }
virtual ~Shape() = default;
};
class Circle : public Shape {
double r;
public:
Circle(double r) : r(r) {}
double area() const override { return 3.14159 * r * r; }
};
class Rectangle : public Shape {
double w, h;
public:
Rectangle(double w, double h) : w(w), h(h) {}
double area() const override { return w * h; }
};
Getters and Setters
class Temperature {
#celsius;
constructor(c) { this.#celsius = c; }
get fahrenheit() { return this.#celsius * 9/5 + 32; }
set fahrenheit(f) { this.#celsius = (f - 32) * 5/9; }
get celsius() { return this.#celsius; }
set celsius(c) { this.#celsius = c; }
}
const t = new Temperature(100);
console.log(t.fahrenheit); // 212
t.fahrenheit = 32;
console.log(t.celsius); // 0
Method chaining
class QueryBuilder {
#table = "";
#conditions = [];
#limit = null;
from(table) { this.#table = table; return this; }
where(cond) { this.#conditions.push(cond); return this; }
take(n) { this.#limit = n; return this; }
build() {
let sql = `SELECT * FROM ${this.#table}`;
if (this.#conditions.length) sql += ` WHERE ${this.#conditions.join(" AND ")}`;
if (this.#limit) sql += ` LIMIT ${this.#limit}`;
return sql;
}
}
const q = new QueryBuilder()
.from("users")
.where("age > 18")
.where("active = true")
.take(10)
.build();
// "SELECT * FROM users WHERE age > 18 AND active = true LIMIT 10"
Comparison: JS vs C++ OOP
| Feature | JavaScript | C++ |
|---|---|---|
| Class syntax | class Foo {} | class Foo {}; |
| Constructor | constructor() | Foo() (same name as class) |
| Inheritance | extends | : public Base |
| Call parent | super() | Base() in initializer list |
| Private | #field | private: section |
| Virtual methods | All methods are virtual-like | Must use virtual keyword |
| Interfaces | Not built-in (use TS) | Pure virtual classes |
| Memory | Garbage collected | Manual or smart pointers |
| Multiple inheritance | No (mixins instead) | Yes |
Design patterns with OOP
Singleton
class Database {
static #instance = null;
static getInstance() {
if (!Database.#instance) {
Database.#instance = new Database();
}
return Database.#instance;
}
constructor() {
if (Database.#instance) throw new Error("Use getInstance()");
this.connection = "connected";
}
}
Factory
class ShapeFactory {
static create(type, ...args) {
switch (type) {
case "circle": return new Circle(...args);
case "rectangle": return new Rectangle(...args);
default: throw new Error(`Unknown shape: ${type}`);
}
}
}
const c = ShapeFactory.create("circle", 5);
Scenario bank (OOP)
7.4a-001 — Create a class hierarchy for vehicles (variation 1)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-002 — Implement encapsulation for a password manager (variation 2)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-003 — Design a polymorphic payment system (variation 3)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-004 — Build a class with method chaining (variation 4)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-005 — Implement the Observer pattern (variation 5)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-006 — Create a singleton logger (variation 6)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-007 — Design a factory for geometric shapes (variation 7)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-008 — Implement inheritance for game characters (variation 8)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-009 — Build a stack using a class (variation 9)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-010 — Create a class with getters and setters (variation 10)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-011 — Implement a linked list class (variation 11)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-012 — Design an event emitter class (variation 12)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-013 — Build a state machine using classes (variation 13)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-014 — Implement the Strategy pattern (variation 14)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-015 — Create a class hierarchy for UI components (variation 15)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-016 — Design a class with private validation (variation 16)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-017 — Implement composition over inheritance (variation 17)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-018 — Build a class that implements iterator protocol (variation 18)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-019 — Create a decorator pattern with classes (variation 19)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-020 — Implement a class-based middleware chain (variation 20)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-021 — Create a class hierarchy for vehicles (variation 21)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-022 — Implement encapsulation for a password manager (variation 22)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-023 — Design a polymorphic payment system (variation 23)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-024 — Build a class with method chaining (variation 24)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-025 — Implement the Observer pattern (variation 25)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-026 — Create a singleton logger (variation 26)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-027 — Design a factory for geometric shapes (variation 27)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-028 — Implement inheritance for game characters (variation 28)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-029 — Build a stack using a class (variation 29)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-030 — Create a class with getters and setters (variation 30)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-031 — Implement a linked list class (variation 31)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-032 — Design an event emitter class (variation 32)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-033 — Build a state machine using classes (variation 33)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-034 — Implement the Strategy pattern (variation 34)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-035 — Create a class hierarchy for UI components (variation 35)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-036 — Design a class with private validation (variation 36)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-037 — Implement composition over inheritance (variation 37)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-038 — Build a class that implements iterator protocol (variation 38)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-039 — Create a decorator pattern with classes (variation 39)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-040 — Implement a class-based middleware chain (variation 40)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-041 — Create a class hierarchy for vehicles (variation 41)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-042 — Implement encapsulation for a password manager (variation 42)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-043 — Design a polymorphic payment system (variation 43)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-044 — Build a class with method chaining (variation 44)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-045 — Implement the Observer pattern (variation 45)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-046 — Create a singleton logger (variation 46)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-047 — Design a factory for geometric shapes (variation 47)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-048 — Implement inheritance for game characters (variation 48)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-049 — Build a stack using a class (variation 49)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-050 — Create a class with getters and setters (variation 50)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-051 — Implement a linked list class (variation 51)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-052 — Design an event emitter class (variation 52)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-053 — Build a state machine using classes (variation 53)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-054 — Implement the Strategy pattern (variation 54)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-055 — Create a class hierarchy for UI components (variation 55)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-056 — Design a class with private validation (variation 56)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-057 — Implement composition over inheritance (variation 57)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-058 — Build a class that implements iterator protocol (variation 58)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-059 — Create a decorator pattern with classes (variation 59)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-060 — Implement a class-based middleware chain (variation 60)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-061 — Create a class hierarchy for vehicles (variation 61)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-062 — Implement encapsulation for a password manager (variation 62)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-063 — Design a polymorphic payment system (variation 63)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-064 — Build a class with method chaining (variation 64)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-065 — Implement the Observer pattern (variation 65)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-066 — Create a singleton logger (variation 66)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-067 — Design a factory for geometric shapes (variation 67)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-068 — Implement inheritance for game characters (variation 68)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-069 — Build a stack using a class (variation 69)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-070 — Create a class with getters and setters (variation 70)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-071 — Implement a linked list class (variation 71)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-072 — Design an event emitter class (variation 72)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-073 — Build a state machine using classes (variation 73)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-074 — Implement the Strategy pattern (variation 74)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-075 — Create a class hierarchy for UI components (variation 75)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-076 — Design a class with private validation (variation 76)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-077 — Implement composition over inheritance (variation 77)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-078 — Build a class that implements iterator protocol (variation 78)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-079 — Create a decorator pattern with classes (variation 79)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-080 — Implement a class-based middleware chain (variation 80)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-081 — Create a class hierarchy for vehicles (variation 81)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-082 — Implement encapsulation for a password manager (variation 82)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-083 — Design a polymorphic payment system (variation 83)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-084 — Build a class with method chaining (variation 84)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-085 — Implement the Observer pattern (variation 85)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-086 — Create a singleton logger (variation 86)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-087 — Design a factory for geometric shapes (variation 87)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-088 — Implement inheritance for game characters (variation 88)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-089 — Build a stack using a class (variation 89)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-090 — Create a class with getters and setters (variation 90)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-091 — Implement a linked list class (variation 91)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-092 — Design an event emitter class (variation 92)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-093 — Build a state machine using classes (variation 93)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-094 — Implement the Strategy pattern (variation 94)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-095 — Create a class hierarchy for UI components (variation 95)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-096 — Design a class with private validation (variation 96)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-097 — Implement composition over inheritance (variation 97)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-098 — Build a class that implements iterator protocol (variation 98)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-099 — Create a decorator pattern with classes (variation 99)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-100 — Implement a class-based middleware chain (variation 100)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-101 — Create a class hierarchy for vehicles (variation 101)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-102 — Implement encapsulation for a password manager (variation 102)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-103 — Design a polymorphic payment system (variation 103)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-104 — Build a class with method chaining (variation 104)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-105 — Implement the Observer pattern (variation 105)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-106 — Create a singleton logger (variation 106)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-107 — Design a factory for geometric shapes (variation 107)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-108 — Implement inheritance for game characters (variation 108)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-109 — Build a stack using a class (variation 109)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-110 — Create a class with getters and setters (variation 110)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-111 — Implement a linked list class (variation 111)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-112 — Design an event emitter class (variation 112)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-113 — Build a state machine using classes (variation 113)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-114 — Implement the Strategy pattern (variation 114)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-115 — Create a class hierarchy for UI components (variation 115)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-116 — Design a class with private validation (variation 116)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-117 — Implement composition over inheritance (variation 117)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-118 — Build a class that implements iterator protocol (variation 118)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-119 — Create a decorator pattern with classes (variation 119)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-120 — Implement a class-based middleware chain (variation 120)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-121 — Create a class hierarchy for vehicles (variation 121)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-122 — Implement encapsulation for a password manager (variation 122)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-123 — Design a polymorphic payment system (variation 123)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-124 — Build a class with method chaining (variation 124)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-125 — Implement the Observer pattern (variation 125)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-126 — Create a singleton logger (variation 126)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-127 — Design a factory for geometric shapes (variation 127)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-128 — Implement inheritance for game characters (variation 128)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-129 — Build a stack using a class (variation 129)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-130 — Create a class with getters and setters (variation 130)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-131 — Implement a linked list class (variation 131)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-132 — Design an event emitter class (variation 132)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-133 — Build a state machine using classes (variation 133)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-134 — Implement the Strategy pattern (variation 134)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-135 — Create a class hierarchy for UI components (variation 135)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-136 — Design a class with private validation (variation 136)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-137 — Implement composition over inheritance (variation 137)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-138 — Build a class that implements iterator protocol (variation 138)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-139 — Create a decorator pattern with classes (variation 139)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-140 — Implement a class-based middleware chain (variation 140)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-141 — Create a class hierarchy for vehicles (variation 141)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-142 — Implement encapsulation for a password manager (variation 142)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-143 — Design a polymorphic payment system (variation 143)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-144 — Build a class with method chaining (variation 144)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-145 — Implement the Observer pattern (variation 145)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-146 — Create a singleton logger (variation 146)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-147 — Design a factory for geometric shapes (variation 147)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-148 — Implement inheritance for game characters (variation 148)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-149 — Build a stack using a class (variation 149)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-150 — Create a class with getters and setters (variation 150)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-151 — Implement a linked list class (variation 151)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-152 — Design an event emitter class (variation 152)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-153 — Build a state machine using classes (variation 153)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-154 — Implement the Strategy pattern (variation 154)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-155 — Create a class hierarchy for UI components (variation 155)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-156 — Design a class with private validation (variation 156)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-157 — Implement composition over inheritance (variation 157)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-158 — Build a class that implements iterator protocol (variation 158)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-159 — Create a decorator pattern with classes (variation 159)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-160 — Implement a class-based middleware chain (variation 160)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-161 — Create a class hierarchy for vehicles (variation 161)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-162 — Implement encapsulation for a password manager (variation 162)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-163 — Design a polymorphic payment system (variation 163)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-164 — Build a class with method chaining (variation 164)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-165 — Implement the Observer pattern (variation 165)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-166 — Create a singleton logger (variation 166)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-167 — Design a factory for geometric shapes (variation 167)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-168 — Implement inheritance for game characters (variation 168)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-169 — Build a stack using a class (variation 169)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.4a-170 — Create a class with getters and setters (variation 170)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.