Posts

Showing posts from February, 2017

SPOJ- PIE solution

Image
Hello! This post is about solution of SPOJ problem PIE :  visit question  PIE So, we will be looking at the implementation part of it using Binary Search. We encourage you to try solving problem first by yourself but still if you are getting trouble then move on to tutorials. Here we require to maximize the cake volume each person would get: Constraints: 1.  Each person would get equal volume of cake. 2.  We will not mix two cake pieces to make one piece.

OR of Pairwise XOR (BITS manipulation)

Image
Hey there!! A new one again on BITs manipulation It is a question given here :-  click here . We encourage you to try solving problem first by yourself but still if you are getting trouble then move on to tutorials. So, in this question we require to  find OR of (XOR of all pairs)  that can be made in a set. As you can see time limit for this question is  2 sec.  So, going by conventional method will require O(n^2) complexity solution. As  n can be 10^6,  Hence it is difficult to pass under given constraints . So what should be the logic?

Sum of Pairwise XOR (explained BITS manipulation)

Image
Hey there!! Waiting for learning new things? So here it is. It is a question given here :- click here . We encourage you to try solving problem first by yourself but still if you are getting trouble then move on to tutorials. So, in this question we require to find sum of XOR of all pairs that can be made in a set. As you can see time limit for this question is 2 sec. So, going by conventional method will require O(n^2) complexity solution. As n can be 10^6, Hence it is difficult to pass under given constraints . So what should be the logic?

Welcome Post

Image
Hi Welcome to My new blog " Greed For Code ". As the name suggests here i will be postings tutorials for different languages and tips to get started into world of programming. I will introduce you to world of competitive programming various tricks and algorithms will be shared and explained thoroughly. So, get your mind ready for something new and really exciting coming up. Get ready and i will be posting a new post about competitive programming. Happy Coding!!