Algorithm · Capital One · Medium
You are given a list of operations queries together with a positive integer diff (strictly greater than zero). Begin with a multiset that contains nothing, then apply the operations one after another: "+x" inserts a single copy of the value x. "-x" deletes every copy of x currently in the multiset; if x is not present, the operation has no effect. Once each operation has been applied, determine how many triplets of values (x, y, z) currently present in the multiset satisfy…