| Title | Open | |||
|---|---|---|---|---|
| 185 | Sum a Vector (STL)Write a function int sumVector(const vector<int>& nums) that returns the sum of all elements using a range-based for loop. | easy | Not started | Solve |
| 454 | Insert Into a SetA set<int> named s has already been declared for you. | easy | Not started | Solve |
| 455 | Print a Set in Sorted OrderA set<int> named s already holds the values 5, 1 and 3. | easy | Not started | Solve |
| 456 | Duplicates Are IgnoredA set<int> named s has been declared for you. | easy | Not started | Solve |
| 457 | Check Membership with countWrite a function bool contains(const set<int>& s, int x) that returns true if x is stored in the set s and false otherwise. | easy | Not started | Solve |
| 458 | Erase a Value from a SetA set<int> named s holds 1, 2, 3 and 4, and a loop that prints the set is already written below it. | easy | Not started | Solve |
| 459 | Set of Strings Sorts AlphabeticallyA set<string> named names has been declared, and a loop that prints each name on its own line is already written. | easy | Not started | Solve |
| 460 | Count Unique ValuesWrite a function int countUnique(const vector<int>& v) that returns how many distinct values appear in v. | easy | Not started | Solve |
| 461 | Smallest and Largest in a SetA set<int> named s holds 7, 2, 9 and 4. | easy | Not started | Solve |
| 462 | multiset Keeps DuplicatesA multiset<int> named ms has been declared for you. | easy | Not started | Solve |
| 463 | unordered_set LookupWrite a function bool hasWord(const unordered_set<string>& words, const string& x) that returns true if x is one of the words in the set and false otherwise. | easy | Not started | Solve |
| 478 | Push and Look at the FrontA queue<int> named q has already been created for you. | easy | Not started | Solve |
| 479 | Pop the FrontA queue<int> named q already holds 10, 20, 30 (10 is at the front). | easy | Not started | Solve |
| 480 | Drain a QueueA queue<int> named q already holds 1, 2, 3 (1 is at the front). | easy | Not started | Solve |
| 481 | Queue StatusWrite a function string status(const queue<int>& q) that returns the string "empty" if the queue has no elements, and "not empty" otherwise. | easy | Not started | Solve |
| 482 | Back of the QueueA queue<int> named q already holds 10, 20, 30 (10 is at the front, 30 is at the back). | easy | Not started | Solve |
| 483 | Priority Queue Puts Largest on TopA priority_queue<int> named pq has already been created. | easy | Not started | Solve |
| 484 | Min-Heap with greaterA min-heap has already been declared for you: priority_queue<int, vector<int>, greater<int>> pq;. | easy | Not started | Solve |
| 485 | Serve the Front CustomerWrite a function void serve(queue<string>& line) that serves the customer at the front of line: print Serving: followed by the front name on its own line, then remove that customer with line.pop(). | easy | Not started | Solve |
| 486 | Deque Push Both EndsA deque<int> named d has already been created, and a loop that prints every element separated by spaces is already written below the comment. | easy | Not started | Solve |
| 487 | Build a Queue from a VectorWrite a function queue<int> toQueue(const vector<int>& v) that returns a new queue<int> containing the elements of v in the same order, so v[0] ends up at the front of the queue. | easy | Not started | Solve |
| 502 | Push and PeekA stack<int> named s has already been created in main. | easy | Not started | Solve |
| 503 | Pop Then PeekA stack<int> named s already holds 1, 2, 3 (3 is on top). | easy | Not started | Solve |
| 504 | Drain a StackA stack<int> named s already holds 1, 2, 3 (3 is on top). | easy | Not started | Solve |
| 505 | Top or NoneWrite a function string topOrNone(const stack<int>& s). | easy | Not started | Solve |
| 506 | Reverse a Word with a StackThe variable word holds "hello", and an empty stack<char> named s and an empty string named result are already declared. | easy | Not started | Solve |
| 507 | Undo History StackA stack<string> named history already holds three actions pushed in this order: "type a", "type b", "delete" (so "delete" is on top). | easy | Not started | Solve |
| 508 | Push All from a VectorWrite a function void pushAll(stack<int>& s, const vector<int>& v) that pushes every element of v onto s, in order from v[0] to the last element (so the last element of v ends up on top). | easy | Not started | Solve |
| 509 | Sum the Top TwoWrite a function int sumTopTwo(stack<int> s) that returns the sum of the two elements nearest the top of the stack. | easy | Not started | Solve |
| 510 | Size After Mixed OperationsAn empty stack<int> named s is already declared. | easy | Not started | Solve |
| 511 | Balanced Round BracketsWrite a function bool balanced(const string& s) that returns true when every ( in s is closed by a matching ) in the correct order, and false otherwise. | easy | Not started | Solve |
| 526 | Fill a std::array in a LoopAn array<int, 5> named a has already been declared for you, and two loops are written: the first loop should fill the array, the second one prints it. | easy | Not started | Solve |
| 527 | Size of a std::arrayAn array<int, 4> named a has been created with the values {10, 20, 30, 40}. | easy | Not started | Solve |
| 528 | Sum a std::arrayWrite a function int sumArray(const array<int, 5>& a) that returns the sum of all five elements. | easy | Not started | Solve |
| 529 | fill With One ValueAn array a of four ints has been declared but not initialized, and a printing loop is already written below it. | easy | Not started | Solve |
| 530 | front and backAn array<int, 3> named a has been created with the values {3, 5, 9}. | easy | Not started | Solve |
| 531 | Bounds-Checked at()An array<int, 4> named a holds {1, 2, 3, 4} and an int index is set to 10. | easy | Not started | Solve |
| 532 | Largest in a std::arrayWrite a function int maxOf(const array<int, 6>& a) that returns the largest of the six values. | easy | Not started | Solve |
| 533 | Array of Strings With IndexAn array<string, 3> named days has been created with the values {"Mon", "Tue", "Wed"} and a loop over i from 0 to 2 is already written. | easy | Not started | Solve |
| 534 | Copying a std::arrayThe code already creates array<int, 3> a = {1, 2, 3};, copies it with array<int, 3> b = a;, and then changes b[0] to 99. | easy | Not started | Solve |
| 535 | Sort a std::arrayAn array<int, 4> named a holds {5, 1, 8, 2}, and a printing loop is already written. | easy | Not started | Solve |
| 550 | Print with an Iterator LoopA vector v has already been created with the values {1, 2, 3}. | easy | Not started | Solve |
| 551 | Dereference and AdvanceA vector v has already been created with the values {10, 20, 30}. | easy | Not started | Solve |
| 552 | Reverse IterationA vector v has already been created with the values {1, 2, 3}. | easy | Not started | Solve |
| 553 | Modify Through an IteratorA vector v has already been created with the values {1, 2, 3}, and an iterator loop over it is already written. | easy | Not started | Solve |
| 554 | const_iterator SumWrite a function int sumConst(const vector<int>& v) that adds up every element by looping with a const_iterator from v.cbegin() to v.cend() and returns the total. | easy | Not started | Solve |
| 555 | Distance Between IteratorsA vector v has already been created with the values {5, 6, 7, 8}. | easy | Not started | Solve |
| 556 | find Returns an IteratorA vector v has already been created with the values {10, 20, 30, 40} and an int target set to 30. | easy | Not started | Solve |
| 557 | next and prevA vector v has already been created with the values {1, 2, 3, 4, 5}. | easy | Not started | Solve |
| 558 | Erase via IteratorA vector v has already been created with the values {1, 2, 3, 4}. | easy | Not started | Solve |
| 559 | Iterating a std::setA set s has already been created from the values {6, 2, 4}. | easy | Not started | Solve |
| 186 | Sort a Vector with std::sortUse std::sort to sort a vector of ints in ascending order. | medium | Not started | Solve |
| 187 | Count Occurrences with std::mapWrite a function int countOccurrences(const vector<int>& nums, int target) that builds a map<int,int> of value to count, then returns the count stored for target (0 if it never appears). | medium | Not started | Solve |
| 464 | Unique Numbers from InputWrite a program that reads an integer N from standard input followed by N integers (all separated by whitespace). | medium | Not started | Solve |
| 465 | Count Newly Inserted ValuesWrite a function int insertAll(set<int>& s, const vector<int>& v) that inserts every element of v into s and returns how many of those insertions actually added a new element. | medium | Not started | Solve |
| 466 | Common Elements of Two SetsWrite a function vector<int> commonElements(const set<int>& a, const set<int>& b) that returns every value present in both sets, in ascending order. | medium | Not started | Solve |
| 467 | Elements Only in the First SetWrite a function set<int> difference(const set<int>& a, const set<int>& b) that returns a new set containing every value that is in a but not in b. | medium | Not started | Solve |
| 468 | Remove Duplicate WordsWrite a program that reads words from standard input until the input ends (use while (cin >> word); the words may be spread over several lines). | medium | Not started | Solve |
| 469 | Erase Evens While IteratingWrite a function void removeEvens(set<int>& s) that erases every even value from s and leaves the odd values in place. | medium | Not started | Solve |
| 470 | First Repeated NumberKeep a set<int> of the values seen so far. | medium | Not started | Solve |
| 471 | First Value At Least XWrite a function int firstAtLeast(const set<int>& s, int x) that returns the smallest value in s that is greater than or equal to x. | medium | Not started | Solve |
| 472 | Tally a multisetA multiset<int> named ms already holds the values 2, 5, 2, 8, 5, 2. | medium | Not started | Solve |
| 473 | Are All Elements Unique?Write a function bool allUnique(const vector<int>& v) that returns true if no value appears more than once in v and false if any value repeats. | medium | Not started | Solve |
| 488 | Read Numbers Into a QueueWrite a program that reads an integer N from standard input, followed by N integers (N is at least 1). | medium | Not started | Solve |
| 489 | Sum a Queue Without Emptying ItWrite a function int sumQueue(queue<int> q) that returns the sum of every element in the queue. | medium | Not started | Solve |
| 490 | Ticket Line SimulationSimulate a ticket line with a queue<string>. | medium | Not started | Solve |
| 491 | Top K LargestWrite a function vector<int> topK(const vector<int>& v, int k) that returns the k largest values of v in descending order (largest first), using a priority_queue<int>. | medium | Not started | Solve |
| 492 | Reverse a Queue Using a StackWrite a function void reverseQueue(queue<int>& q) that reverses the order of the elements in q in place, using a stack<int> as a helper. | medium | Not started | Solve |
| 493 | Print Heap Values DescendingA priority_queue<int> named pq has already been created and filled with 4, 9, 1, 7. | medium | Not started | Solve |
| 494 | Priority Queue of PairsA priority_queue<pair<int, string>> tasks; has already been declared. | medium | Not started | Solve |
| 495 | Interleave Two QueuesWrite a function queue<int> interleave(queue<int> a, queue<int> b) that returns a new queue built by alternating elements: first the front of a, then the front of b, then the next element of a, then the next of b, and so on. | medium | Not started | Solve |
| 496 | Keep Only the Last NWrite a function deque<int> keepLast(const vector<int>& v, int n) that returns a deque holding only the last n elements of v, in their original order. | medium | Not started | Solve |
| 497 | Kth Smallest with a Min-HeapWrite a function int kthSmallest(const vector<int>& v, int k) that returns the k-th smallest value of v, where k = 1 means the smallest of all. | medium | Not started | Solve |
| 512 | Reverse Numbers from InputWrite a program that reads integers from standard input until the input ends, pushes each one onto a stack<int>, and then pops them all to print the numbers in reverse order on one line, separated by single spaces, followed by a newline. | medium | Not started | Solve |
| 513 | Balanced Brackets Three KindsWrite a function bool isBalanced(const string& s) that uses a stack<char> to check whether the brackets in s are balanced. | medium | Not started | Solve |
| 514 | Evaluate PostfixWrite a function int evalPostfix(const vector<string>& tokens) that uses a stack<int> to evaluate an expression written in postfix (Reverse Polish) notation. | medium | Not started | Solve |
| 515 | Decimal to Binary with a StackWrite a function string toBinary(int n) that returns the binary representation of n as a string, using a stack<int>. | medium | Not started | Solve |
| 516 | Sum a Stack CopyWrite a function int sumStack(stack<int> s) that returns the sum of every element in the stack. | medium | Not started | Solve |
| 517 | Undo Text EditorWrite a program that simulates a tiny text editor with undo. | medium | Not started | Solve |
| 518 | Next Greater ElementWrite a function vector<int> nextGreater(const vector<int>& v) that returns a vector of the same length where position i holds the first element to the right of v[i] that is strictly greater than v[i], or -1 if no such element exists. | medium | Not started | Solve |
| 519 | Stack to Vector Bottom FirstWrite a function vector<int> bottomFirst(stack<int> s) that returns the stack's contents as a vector ordered from the bottom of the stack to the top. | medium | Not started | Solve |
| 520 | Remove Adjacent DuplicatesWrite a function string removeAdjacent(const string& s) that uses a stack<char> to repeatedly delete pairs of equal adjacent characters until no such pair remains, and returns whatever is left. | medium | Not started | Solve |
| 521 | Palindrome Check with a StackWrite a function bool isPalindrome(const string& s) that uses a stack<char> to decide whether s reads the same forwards and backwards. | medium | Not started | Solve |
| 536 | Five Numbers from InputWrite a program that reads exactly five integers from standard input (separated by spaces or newlines) into an array<int, 5>, then prints their sum and their average. | medium | Not started | Solve |
| 537 | Reverse a std::array In PlaceWrite a function void reverseArray(array<int, 5>& a) that reverses the order of the five elements inside the array itself (no return value, no second array). | medium | Not started | Solve |
| 538 | Count Even ValuesWrite a function int countEven(const array<int, 8>& a) that returns how many of the eight elements are even. | medium | Not started | Solve |
| 539 | Sum Any Size (Template Parameter)Write a function template template <size_t N> int sumAny(const array<int, N>& a) that returns the sum of all elements of an array<int, N> for any N. | medium | Not started | Solve |
| 540 | 3x3 Grid with Nested std::arrayA variable grid of type array<array<int, 3>, 3> has been declared for you. | medium | Not started | Solve |
| 541 | Index of a ValueWrite a function int indexOf(const array<int, 6>& a, int x) that returns the index (0 to 5) of the first element equal to x, or -1 if x does not appear in the array. | medium | Not started | Solve |
| 542 | Rotate Left by OneWrite a function void rotateLeft(array<int, 5>& a) that moves every element one position to the left, and moves the element that was at index 0 to the end. | medium | Not started | Solve |
| 543 | Swap Two ArraysThe code already creates array<int, 3> a = {1, 2, 3}; and array<int, 3> b = {4, 5, 6};. | medium | Not started | Solve |
| 544 | Weekly Temperature ReportAn array<double, 7> named temps holds one temperature per day of the week: {24.5, 26.0, 31.5, 22.0, 28.0, 25.5, 27.3}. | medium | Not started | Solve |
| 545 | Compare Two ArraysWrite a function bool sameContents(const array<int, 4>& a, const array<int, 4>& b) that returns true when the two arrays hold the same values in the same order and false otherwise. | medium | Not started | Solve |
| 560 | Sum Between Two IteratorsWrite a function int sumRange(vector<int>::iterator first, vector<int>::iterator last) that returns the sum of every element in the half-open range from first to last. | medium | Not started | Solve |
| 561 | Erase Every Matching ValueWrite a function void removeValue(vector<int>& v, int x) that removes every element equal to x from v, keeping the other elements in their original order. | medium | Not started | Solve |
| 562 | Insert Before a ValueWrite a function void insertBefore(vector<int>& v, int target, int val) that: 1. | medium | Not started | Solve |
| 563 | Second Largest with Iterator ArithmeticWrite a function int secondLargest(vector<int> v) that returns the second-largest value in v. | medium | Not started | Solve |
| 564 | Print Every Other ElementWrite a function void printEveryOther(const vector<int>& v) that prints the elements at positions 0, 2, 4, ... | medium | Not started | Solve |
| 565 | Reverse a String with Reverse IteratorsWrite a function string reversed(const string& s) that returns a new string containing the characters of s in reverse order, built from s.rbegin() and s.rend(). | medium | Not started | Solve |
| 566 | Index of the MaximumWrite a function int indexOfMax(const vector<int>& v) that returns the 0-based index of the largest element in v using max_element (from <algorithm>). | medium | Not started | Solve |
| 567 | Iterate a Map with IteratorsA map<string, int> named stock has already been created with apple mapped to 3 and pear mapped to 5. | medium | Not started | Solve |
| 568 | Reverse Input with Reverse IteratorsWrite a program that reads whole numbers from standard input until there is no more input (end of file), stores them in a vector<int>, and then prints them in reverse order on one line, each number followed by a single space, ending with a newline. | medium | Not started | Solve |
| 569 | First Half by Iterator RangeWrite a function vector<int> firstHalf(const vector<int>& v) that returns a new vector containing the first v.size() / 2 elements of v (integer division, so for an odd size the middle element is left out). | medium | Not started | Solve |
| 474 | Unique Word TrackerBuild a class UniqueWords that stores the distinct words in a set<string>. | hard | Not started | Solve |
| 475 | Number Set Range QueriesBuild a class NumberSet that stores distinct integers in a set<int> and answers range queries. | hard | Not started | Solve |
| 476 | Set Algebra From InputRead two lines from standard input. | hard | Not started | Solve |
| 477 | Inventory with multisetBuild a class Inventory that stores item names in a multiset<string>, so the same name can be held several times. | hard | Not started | Solve |
| 498 | Printer Job SchedulerBuild a class PrintQueue that serves print jobs first-come, first-served, storing each job's name and page count in a queue. | hard | Not started | Solve |
| 499 | Emergency Room TriageBuild a class Triage that decides which emergency-room patient is seen next, using a priority_queue with a custom comparator. | hard | Not started | Solve |
| 500 | Round-Robin SchedulerWrite a round-robin CPU scheduler. | hard | Not started | Solve |
| 501 | Josephus Elimination Ordern people numbered 1 to n stand in a circle. | hard | Not started | Solve |
| 522 | Min StackBuild a class MinStack that behaves like a normal stack of ints but can also report its smallest element in constant time — getMin() must not scan the stack. | hard | Not started | Solve |
| 523 | Infix to PostfixWrite a function string toPostfix(const string& expr) that converts an infix arithmetic expression to postfix notation using a stack of operators. | hard | Not started | Solve |
| 524 | Browser HistoryBuild a class BrowserHistory that models the back and forward buttons of a web browser using two stacks. | hard | Not started | Solve |
| 525 | Queue Made of Two StacksBuild a class StackQueue that behaves like a first-in first-out queue of ints but is implemented with two stack<int> members only (no queue, deque or vector). | hard | Not started | Solve |
| 546 | Fixed-Size Ring BufferBuild a class RingBuffer that stores its values in an array<int, 4> (capacity 4) and never allocates anything else. | hard | Not started | Solve |
| 547 | Tic-Tac-Toe WinnerA tic-tac-toe board is an array<array<char, 3>, 3>: b[row][col] is 'X', 'O', or '.' for an empty cell. | hard | Not started | Solve |
| 548 | 2x2 Matrix MultiplyA 2x2 matrix is an array<array<int, 2>, 2>, where m[r][c] is the value in row r, column c. | hard | Not started | Solve |
| 549 | Digit Histogram from InputWrite a program that reads non-negative integers from standard input until the input ends. | hard | Not started | Solve |
| 570 | Countdown Range ClassCreate a class Countdown with: 1. | hard | Not started | Solve |
| 571 | Remove Duplicates Keeping OrderWrite a function void dedupe(vector<int>& v) that modifies v in place so that each value appears only once, keeping the FIRST occurrence of every value and preserving the original relative order. | hard | Not started | Solve |
| 572 | Merge Two Sorted VectorsWrite a function vector<int> mergeSorted(const vector<int>& a, const vector<int>& b) where a and b are each sorted ascending. | hard | Not started | Solve |
| 573 | Linked List with IteratorCreate a class IntList, a singly linked list of ints, with: 1. | hard | Not started | Solve |