---
title: "Discussion on \"Count the number of sub-arrays with at least k pairs of indices (i, j) such that i < j and arr[i] == arr[j] in a given array.\" | Hashnode"
description: "Discussion on \"Count the number of sub-arrays with at least k pairs of indices (i, j) such that i < j and arr[i] == arr[j] in a given array.\". Given an integer array arr and an integer k, count the number of good sub-arrays of arr. A sub-array arr is good if there are at least k pairs of indices [ i, j ] such that i < j and arr[i] == arr[j].\nExamples :\n\nInput: arr = [3,1,4,3,2,2,4], k = 2 O..."
url: "https://hashnode.com/posts/count-the-number-of-sub-arrays-with-at-least-k-pairs-of-indices-i-j-such-that-i-j-and-arri-arrj-in-a-given-array/64042f1ff474a6517907248a"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Count the number of sub-arrays with at least k pairs of indices (i, j) such that i < j and arr\[i\] == arr\[j\] in a given array.](https://decocodes.hashnode.dev/count-the-number-of-sub-arrays-with-at-least-k-pairs-of-indices-i-j-such-that-i-j-and-arri-arrj-in-a-given-array?utm_source=hashnode&utm_medium=feed)

Given an integer array arr and an integer k, count the number of good sub-arrays of arr. A sub-array arr is good if there are at least k pairs of indices \[ i, j \] such that i < j and arr\[i\] == arr\[j\]. Examples : Input: arr = \[3,1,4,3,2,2,4\], k = 2 O...

Mar 5, 2023 · 10 min read · decocodes.hashnode.dev  
Read the article

-   [#dsa](https://hashnode.com/tag/dsa)
-   [#programming-blogs](https://hashnode.com/tag/programming-blogs)
-   [#java](https://hashnode.com/tag/java)

## Written by

[Decostar Sharma](https://hashnode.com/@Decostar)

@Decostar

  
[View profile](https://hashnode.com/@Decostar)

Content & Vocabulary

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
