Person Greeting

Easy
2 views 24 Jan 2026
Name and age are provided. Create class Person with method greet() that returns 'Hi , you are '. Output greet()....

Rectangle Area

Easy
2 views 24 Jan 2026
Length and width are provided. Create Rectangle class with area() method. Output area as integer....

Bank Balance

Easy
2 views 24 Jan 2026
You have a bank account with starting balance B. Then q commands: DEP x, WIT x (withdraw, but if not enough keep same). Output final balance....

Simple Counter

Easy
2 views 24 Jan 2026
You have q commands: INC, DEC. Create Counter class. DEC cannot go below 0. Output final value....

Student Average

Easy
2 views 24 Jan 2026
Read n marks. Create Student class with method avg(). Output average with 2 decimals....

Point Distance

Easy
3 views 24 Jan 2026
Read two integers x and y. Create Point class with method dist0() giving distance from origin. Output with 3 decimals....

Book Thick Check

Easy
2 views 24 Jan 2026
Title (no spaces) and pages are provided. Create Book class with method thick() that returns YES if pages>300 else NO....

Temperature Convert Class

Easy
2 views 24 Jan 2026
Celsius value is provided. Create Temperature class with method to_f(). Output Fahrenheit with 2 decimals....

Car Fuel Check

Easy
2 views 24 Jan 2026
Distance d, mileage m (km per litre) and fuel f are provided. Create Car class can_reach(d) returns YES if fuel enough else NO....

Stack Class

Easy
2 views 24 Jan 2026
You will receive q commands: PUSH x, POP, TOP. Create Stack class and for TOP output value or EMPTY....

Inventory Total Cost

Medium
2 views 24 Jan 2026
Read n items each with name, price, qty. Create Item class with total() method. Output grand total cost....

Sort Circles By Area

Medium
4 views 24 Jan 2026
Read n radii. Create Circle class with area() and sort circles by area ascending. Output sorted radii....

Time Add Seconds

Medium
2 views 24 Jan 2026
Time hh mm ss and extra seconds x are provided. Create Time class add(x) and output new time in HH:MM:SS (24h)....

Employee Yearly Salary

Medium
3 views 24 Jan 2026
Read monthly salary and bonus percent. Create Employee class yearly() to return yearly salary with bonus included. Output as integer....

Fraction Add

Medium
2 views 24 Jan 2026
Read two fractions a/b and c/d. Create Fraction class that reduces and supports add. Output result as p q reduced....

Matrix Sum

Medium
2 views 24 Jan 2026
Read r c and two matrices. Create Matrix class with add method. Output resulting matrix....

Task Tracker

Medium
2 views 24 Jan 2026
You will receive q commands: ADD name, DONE name, COUNT. Create TaskTracker class. COUNT prints how many tasks are pending....

Group Scores

Medium
6 views 24 Jan 2026
Read n entries name score. Create Player class and group by name summing scores. Output names sorted with total score....

Shopping Cart

Medium
2 views 24 Jan 2026
You will receive q commands: ADD item price, REMOVE item, TOTAL. Create Cart class. TOTAL prints sum of prices of current items....

Queue With Two Stacks

Medium
3 views 24 Jan 2026
You will receive q commands: ENQ x, DEQ, FRONT. Create Queue class using two stacks. FRONT prints front value or EMPTY....

URL Parts

Medium
2 views 24 Jan 2026
One URL string like domain/path is provided (no spaces). Create URL class with domain() and path() methods. If no '/', path is EMPTY....

Password Rules

Medium
3 views 24 Jan 2026
Read a password string. Create Validator class ok() that checks: length>=8, has at least one digit, one uppercase, one lowercase. Output YES or NO....

Polynomial Evaluate

Medium
2 views 24 Jan 2026
Read degree n, then n+1 coefficients from highest to constant, and x. Create Polynomial class eval(x). Output value....

Min Stack Class

Hard
2 views 24 Jan 2026
You will receive q commands: PUSH x, POP, MIN. Create MinStack class and for MIN output current minimum or EMPTY....

LRU Cache Class

Hard
4 views 24 Jan 2026
Cache capacity cap is provided and q commands: PUT k v, GET k. Implement LRUCache class. For GET output value or -1....

Graph Shortest Path Class

Hard
3 views 24 Jan 2026
Read n m edges and s t. Create Graph class with bfs(s,t) method. Output shortest distance or -1....

Calendar Conflicts

Hard
3 views 24 Jan 2026
Read n meetings as start end. Create Calendar class add(start,end) returns YES if added else NO (conflict if overlap). Output results for each add....

Nested Store Class

Hard
2 views 24 Jan 2026
You will receive q commands: SET path value, GET path. Path is dot separated. Create Store class to handle. For GET output value or NOT FOUND....

Sparse Vector Dot Product

Hard
3 views 24 Jan 2026
Two sparse vectors are provided as list of index:value pairs. Build SparseVector class with dot(other). Output dot product....

Complex Numbers Sum and Product

Medium
4 views 24 Jan 2026
Read two complex numbers as a b and c d, meaning (a+bi) and (c+di). Create Complex class with add and mul. Output sum then product as 'x y' for real and imag....

Email Normalizer

Medium
2 views 24 Jan 2026
Read n email strings. Create Email class that normalizes (lowercase, trim spaces). Output count of unique normalized emails....

Connectivity Queries (DSU)

Hard
2 views 24 Jan 2026
Read n and q queries. Make DSU class with find and union. Queries: UNION u v, ASK u v. For ASK output YES if connected else NO....

Trie Prefix Counter

Hard
3 views 24 Jan 2026
Read q operations: ADD word or COUNT prefix. Create Trie class. For COUNT output how many added words have this prefix....

Median Finder Class

Hard
3 views 24 Jan 2026
You will receive q commands: ADD x or MEDIAN. Create MedianFinder class using two heaps. For MEDIAN output lower median (floor for even count)....

Segment Tree Range Minimum

Hard
4 views 24 Jan 2026
Read n numbers and q queries. Build SegmentTree class with update(i,x) and query(l,r) returning minimum. Output query answers....