SOLVE

LATER

Milly and special subarrays

Problem

Editorial

Analytics

Milly is playing with an array **A** of size **N**. She is trying to find those non-empty subarrays (sequence of consecutive elements) whose maximum and minimum values are identical. Milly got confused while counting. Your task is to help her in this problem.

- First line of the input will contain
**T**denoting the number of test-cases. - For every test case, first line will contain
**N**. Next line will contain**N**space separated integers denoting**A**._{i}

- For every test case, print the required answer in a separate line.

- 1 ≤
**T**≤ 10 - 1 ≤
**N**≤ 10^{5} - 1 ≤
**|A**≤ 10_{i}|^{9}
Here,

Explanation

**Test case 1:**

Special subarrays for the given sample case include :- [1], [1], [3], [1, 1].

Time Limit:
1.0 sec(s)
for each input file.

Memory Limit:
256 MB

Source Limit:
1024 KB

Marking Scheme:
Marks are awarded when all the testcases pass.

Allowed Languages:
C,
C++,
C++14,
Clojure,
C#,
D,
Erlang,
F#,
Go,
Groovy,
Haskell,
Java,
Java 8,
JavaScript(Rhino),
JavaScript(Node.js),
Julia,
Kotlin,
Lisp,
Lisp (SBCL),
Lua,
Objective-C,
OCaml,
Octave,
Pascal,
Perl,
PHP,
Python,
Python 3,
R(RScript),
Racket,
Ruby,
Rust,
Scala,
Swift,
Visual Basic

Initializing Code Editor...

{"6859500": "/pagelets/problem-author-tester/algorithm/milly-and-special-subarrays-3/", "7f821c3": "/pagelets/suggested-problems/algorithm/milly-and-special-subarrays-3/", "5d0db62": "/pagelets/show-submission/algorithm/milly-and-special-subarrays-3/", "d7571a1": "/pagelets/recommended-problems/algorithm/milly-and-special-subarrays-3/", "a1dda86": "/pagelets/problems-hint/algorithm/milly-and-special-subarrays-3/"}

realtime.hackerearth.com

80

d4164bef8955537699471e6caa5c459d2c5e5236

58a29e5cae2309f04b28

/realtime/pusher/auth/