Skip to main content

Medium ✔

  1. Sort Characters by Frequency
    1. 05 March, 2026: 00.07.23 ❌
      • Failed at implementation(sort function), approach was right
      • Place two operats of container types, the following is used for a container of pair<int, int> type, which one you want first, keep that at first during comparison
        [](pair<int, int> a, pair<int, int> b) {
        return a.second > b.second;
        });
    2. 30 March, 2026: 00.17.43 ❌
      • Failed at implementation(string building), approach was right
      • string(count, char) create a string with given char length of count
  2. Maximum Nesting Depth of the Parentheses
    1. 17 March, 2026: 00.01.12 ❌
      • Failed at implmentation
      • Depth of the Parentheses count by increasing for ( and decreasing )
    2. 30 March, 2026: 00.02.14 ✔
  3. Roman to Integer
    1. 05 March, 2026: 00.14.17 ✔
    2. 30 March, 2026: 00.16.22 ✔
  4. String to Integer (atoi)
    1. 21 March, 2026: 00.22.46 ❌
      • Failed at implementation
      • Remove the leading whitespace manually(just extract the correct index).
      • Handle the overflow and both (+ and -) sign
    2. 30 March, 2026: 00.17.54 ✔
      • your handle overflow even after storing it
      • Remove only the leading whitespace
      • Then check for digit and alpha numeric charecter
  5. Sum of Beauty of All Substrings
    1. 27 March, 2026: 00.17.13 ❌
      • Failed at intitution
        SubstringFrequenciesMaxMinBeauty
        aa=1110
        aaa=2220
        aaba=2, b=1211
        aabca=2, b=1, c=1211
        aabcba=2, b=2, c=1211
        aabcbaa=3, b=2, c=1312
        aabcbaaa=4, b=2, c=1413
        aa=1110
        aba=1, b=1110
        abca=1, b=1, c=1110
        abcba=1, b=2, c=1211
        abcbaa=2, b=2, c=1211
        abcbaaa=3, b=2, c=1312
        bb=1110
        bcb=1, c=1110
        bcbb=2, c=1211
        bcbab=2, c=1, a=1211
        bcbaab=2, c=1, a=2211
        cc=1110
        cbc=1, b=1110
        cbac=1, b=1, a=1110
        cbaac=1, b=1, a=2211
        bb=1110
        bab=1, a=1110
        baab=1, a=2211
        aa=1110
        aaa=2220
        aa=1110
    2. 30 March, 2026: 00.17.44 ❌
      • Inner loop generate substring, each iteration in inner loop generate a new substring, so calcualte the freq for each iteration in inner loop
  6. Reverse every word in a string