Competitive Programming

Codeforces 665 C. Simple Strings

Problem Statement: http://codeforces.com/problemset/problem/665/C Approach : Simply dissociate the whole string into sequences that have similar consecutive characters. • If there are odd numbers of consecutive characters simply replace alternative characters. For example, “aaaaa” becomes “ababa”. • If there are even numbers of character do the same as above. However check that the last character of… Continue reading Codeforces 665 C. Simple Strings

Competitive Programming

Codeforces 673 A. Timofey and a tree

Problem Statement: http://codeforces.com/problemset/problem/763/A Approach : The easiest way to solve this problem is like this. First find all the edges which have nodes having dissimilar values. Let’s call these edges “Magic Edges”. These edges are basically those edges which shall connect two different sub-trees. Now, simply check whether all the “Magic Edges” have some common… Continue reading Codeforces 673 A. Timofey and a tree