Posts

Showing posts from 2026

Happy New Year - Frequency Count

Image
Happy 2026. First problem is a medium difficulty, just use frequency count (hint is that we're dealing only with lowercase letters). Also make sure to use long to avoid overflow. Code is down below, cheers, ACC. Minimum Deletion Cost to Make All Characters Equal - LeetCode You are given a string  s  of length  n  and an integer array  cost  of the same length, where  cost[i]  is the cost to  delete  the  i th  character of  s . You may delete any number of characters from  s  (possibly none), such that the resulting string is  non-empty  and consists of  equal  characters. Return an integer denoting the  minimum  total deletion cost required.   Example 1: Input:   s = "aabaac", cost = [1,2,3,4,1,10] Output:   11 Explanation: Deleting the characters at indices 0, 1, 2, 3, 4 results in the string  "c" , which consists of equal characters, and the total cost is ...