2 views
24 Jan 2026
Name and age are provided. Create class Person with method greet() that returns 'Hi , you are '. Output greet()....
2 views
24 Jan 2026
Length and width are provided. Create Rectangle class with area() method. Output area as integer....
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....
2 views
24 Jan 2026
You have q commands: INC, DEC. Create Counter class. DEC cannot go below 0. Output final value....
2 views
24 Jan 2026
Read n marks. Create Student class with method avg(). Output average with 2 decimals....
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....
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....
2 views
24 Jan 2026
Celsius value is provided. Create Temperature class with method to_f(). Output Fahrenheit with 2 decimals....
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....
2 views
24 Jan 2026
You will receive q commands: PUSH x, POP, TOP. Create Stack class and for TOP output value or EMPTY....
2 views
24 Jan 2026
Read n items each with name, price, qty. Create Item class with total() method. Output grand total cost....
4 views
24 Jan 2026
Read n radii. Create Circle class with area() and sort circles by area ascending. Output sorted radii....
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)....
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....
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....
2 views
24 Jan 2026
Read r c and two matrices. Create Matrix class with add method. Output resulting matrix....
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....
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....
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....
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....
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....
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....
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....
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....
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....
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....
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....
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....
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....
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....
2 views
24 Jan 2026
Read n email strings. Create Email class that normalizes (lowercase, trim spaces). Output count of unique normalized emails....
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....
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....
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)....
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....