C++ Exercises: Data Structure II

Exercises: 232. Implement Queue using Stacks Implement a first in first out (FIFO) queue using only two stacks. The implemented queue should support all the functions of a normal queue (push, peek, pop, and empty). Solution: take advantage of the features of both stacks #include <iostream> #include <set> #include <vector> #include <algorithm> #include <stack> Read more…

C++ Exercises: Data Structure I

Exercises: 448. Find All Numbers Disappeared in an Array Given an array nums of n integers where nums[i] is in the range [1, n], return an array of all the integers in the range [1, n] that do not appear in nums.Solution: use set to record all numbers had showed and find the the rest disappeared numbers. Tips: you can also increase Read more…

Content Summary
: Input your strings, the tool can get a brief summary of the content for you.

X