saritapatel8770 / Leetcode-solutions

7 stars 46 forks source link

Added C++ solution to Optimal Partition of String Problem #59

Closed Jay179-sudo closed 2 years ago

Jay179-sudo commented 2 years ago

This PR references #20

Added C++ solution to Optimal Partition of String Problem

The approach was taking a hash map to keep track of values and clearing it whenever we saw a duplicate element. Every time the hash map was cleared, we created a partition between two groups! The result + 1 gives us the optimal number of groups this way.

Thank you!