---
title: "Discussion on \"How To Find The Maximal Subarray Having Distinct Elements\" | Hashnode"
description: "Discussion on \"How To Find The Maximal Subarray Having Distinct Elements\". A simple C++ solution to Leetcode 1695. Maximum Erasure Value using a sliding window approach and prefix sums."
url: "https://hashnode.com/posts/1695-maximum-erasure-value/63313902991ed32fba41a894"
---

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

Discussion

# [How To Find The Maximal Subarray Having Distinct Elements](https://leetsolve.com/1695-maximum-erasure-value?utm_source=hashnode&utm_medium=feed)

A simple C++ solution to Leetcode 1695. Maximum Erasure Value using a sliding window approach and prefix sums.

Jan 9, 2024 · 2 min read · leetsolve.com  
Updated Jan 27, 2024  
Read the article

-   [#cpp](https://hashnode.com/tag/cpp)
-   [#programming-blogs](https://hashnode.com/tag/programming-blogs)
-   [#learn-coding](https://hashnode.com/tag/learn-coding)
-   [#algorithms](https://hashnode.com/tag/algorithms)
-   [#programming-tips](https://hashnode.com/tag/programming-tips)

## Written by

[Nhut Nguyen](https://hashnode.com/@nhutnguyen)

@nhutnguyen · Copenhagen, Denmark

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

Software developer and Writer

Hi! My name is Nhut Nguyen. I am a software engineer and a writer in Copenhagen, Denmark. Learn more about me at nhutnguyen.com

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
