Number of Contiguous Subarrays with all duplicates
Given an Array consisting of N integers, Count the number of contiguous subarrays where each element in the subarray appears 2 or more times. Examples : Input : n = 3 arr = [0, 0, 0] Output : 3 [0],[0],[0] – 0 [0,0],[0,0] – 2 [0,0,0] – 1 Total = 2 + 1 = 3 Input : n… Read More »