Problem Statement: https://www.hackerearth.com/practice/data-structures/advanced-data-structures/fenwick-binary-indexed-trees/practice-problems/algorithm/help-ashu-1/ Approach : We can solve the problem using Binary Index Tree(BIT). We store all the indexes which are odd. Now, in-case we have to find all the odd numbers we can simply find the sum in the range. To find the even numbers we simply have to subtract all the odd numbers… Continue reading Hackerearth : Help Ashu
Category: Competitive Programming
Codeforces 345 A. Joysticks
Problem Statement: http://codeforces.com/problemset/problem/651/A Approach : We can solve the problem using simple DP memorization. Solution :
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
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
Codeforces 136 B: Little Elephant and Array
Problem Statement: http://codeforces.com/problemset/problem/220/B Approach : Simple DP Solution :
Codechef :Our Base is Under Attack
Problem statement:https://www.codechef.com/problems/BASE/ Approach:Binary Search Solution:
Codeforces 219 D. Choosing Capital for Treeland
Problem Statement: http://codeforces.com/problemset/problem/219/D Approach : Simple DFS. For Node 4 : No. of downward arrows in path from 1 + No. of upward arrows in rest of the tree except the path 0 + 2 2 This is same for Node 2,3 as well 🙂 Solution :
Codeforces 118 D: Caesar’s Legions
Problem Statement: http://codeforces.com/contest/118/problem/D Approach : Simple memorization . Solution :
Codeforces 489 D: Unbearable Controversy of Being
Codeforces 448 D: Multiplication Table
http://codeforces.com/problemset/problem/448/D How to Solve: https://www.quora.com/How-is-the-following-problem-solvable-using-Binary-Search-Problem-448D-Codeforces Please follow the above link ! Solution :