Company: Autodesk_10april
Difficulty: medium
Query Processing and Triple Counting Problem Description Given an empty array of integers, numbers , your task is to process a list of queries . Specifically, there are two types of queries: "+x" : Append the integer x to numbers . Note that numbers may contain multiple instances of the same integer. "-x" : Remove all instances of the integer x from numbers . After processing each query, count the number of triples (x, y, z) in numbers which meet this condition: both x - y and y - z are equal to a given diff . Note that elements in numbers can be rearranged to form triples to meet the condition. The final output should be an array of counts, where each element is the number of valid triples after processing the corresponding query in queries . Examples Example 1: Input: queries = ["+4", "+5", "+6", "+4", "+3", "-4"], diff = 1 Output: [0, 0, 1, 2, 4, 0] Explanation: First, process queries[0] = "+4" and append 4 to numbers , resulting in numbers = [4] . There are no triples yet, so appen