0w1

SRM

SRM 630 Div2

SRM

Easy. DoubleLetterProblem Description: You are given a string S. Each time you can choose two consecutive letters that are identical, and remove them. After removal, both sides are connected, i.e., the result still remains to be a string. …

SRM 673 Div2

SRM

Easy. BearSongProblem Description: Given an array with N elements, count number of elements that appeared exactly once.Constraints: 1 ≤ N ≤ 50 1 ≤ A[i] ≤ 1000Solution: FunctionalCode: class BearSong { public: int countRareNotes(std::vector<int></int>…

SRM 679 Div2

SRM

Easy. ListeningSongsProblem Description: There are two playlists. A playlist consists of some songs, each described by the units of time it takes. You have listen to at least T songs from each playlist. Given that you have at most minutes …

SRM 687 Div2

SRM

Easy. Quorum:Problem Description: You are given N elements. Find the sum of the minimum K elements.Constraints: 1 ≤ K ≤ N ≤ 50Solution: Sort and greedy.Code: class Quorum { public: int count(std::vector<int> arr, int k) { std::sort(arr.begin(),</int>…

SRM 700 Div2

SRM

Easy. Xylophone:Code: class Xylophone { public: int countKeys(std::vector<int> keys) { std::set<int> bag; for (int v : keys) bag.emplace(v % 7); return bag.size(); } }; Medium. XMarksTheSpot:Problem Description: You are given a 2D board. There are t</int></int>…

SRM 701 Div2

SRM

Easy. SquareFreeString:Problem Description: Given a string, determine whether there is a substring that is squared (e.g., ww).Constraints: s.size ≤ 50Solution: O(s.size ** 4)Code: class SquareFreeString { public: std::string isSquareFree(s…

SRM 702 Div2

SRM

Easy. TestTaking:Problem Description: There are q false/true questions, in which you guessed g are true, and there are a that are really true. Output the maximum number of questions you might get correct.Constraints: 1 ≤ Q ≤ 50Solution: As…

SRM 710 Div2

SRM

Easy. MagicSubset:Problem Description: There are N stones with some weight. The first stone is magical, and if you choose it, each stone will have its weight multiplied by -1. Output the maximum weight sum you can obtain.Constraints: 1 ≤ N…