# About

Heya..

This is a blog which I had created out of no reason, well, perhaps it had only one reason and that being, to have a place on the internet with my name :P. Since I don’t have the money to register for a domain for myself, let this be my corner. Anyways, I am a student (about to turn pro) of Computer Sciences and I do not enjoy computers very much but still they keep me surprising every now and then so I guess we’ve kind of made up. I will try to post something relevant on this blog, although I don’t appreciate blogging myself. This blog will be more programming and problem solving oriented than me expressing my views on why the F I don’t have a GF or why the F is JV compulsory in my college :P. This will be a clean place.

Avi

Hey Avi,

Good blog and a good collection of programming ques. I really had time surfing your blog. Continue the good work!

Thanks

Ranga

Hey Ranga,

Thanx for the appreciation.

Avi

Your blog is quite good. Programming section is the one I like the most.

just a feedback, that it would be great if you organise the things here a bit more. the boundaries of categories is bit difficult to get in first go.

keep it up btw. waiting for more posts. 🙂

Thanx a lot Ankit

Even I feel uncomfortable browsing my blog :P, but I will try to learn some ways of organizing things here. Also this being a non-premium account, I cannot do much with it. Still, I’ll try my best and consult a blogger.

Thanx again for the feedback, and yes I’ll be up with more questions. Do pour in your valuable suggestions. Njoi Programming 🙂

😉 😛 🙂

sir its really gr8 blog ,,,,,,,,,,,,,,,

can i knoe abt u ,,,,,,

One real good thing about your collection is that there are no freebies & all require some levels of thinking.

Good work man. Keep it up !

Thanx Kushagra 🙂

Not providing freebies was a part of the objectives of the blog 😛

Excellent work ! keep it up .

hi Avi,

Its a great work from your side man…………

Hats off ! superb blog helped me alot ..thank you Avi !

Hi,

Could you kindly help me out with this problem

Modified 2 color sort problem i.e. you are given an array of integers containing only 0s and 1s.You have to place all the 0s in even position and 1s in odd position. And if suppose, no. of 0s exceed no. of 1s or vice versa then keep them untouched. Do that in ONE PASS and without taking extra memory (modify the array in-place).

For Example :

Input Array: {0,1,1,0,1,0,1,0,1,1,1,0,0,1,0,1,1}

Output Array: {0,1,0,1,0,1,0,1,0,1,0,1,0,1,1,1,1}

Very nice effort avi..i liked some of your interview questions…keep doing buddy

Thanx umar 🙂

Can U explain me this problem…

solution should not be by using backtracking…it should be proper answer and if we get this answer we should be able to write general programm for n number of rivers

There is a priest in a certain village who performs Pooja at 3 temples and to reach each temple he has to cross a river. These rivers have a magical property because of which when he crosses the river the flowers that he carries double. He starts in the morning comes to first river and plucks some flowers from a tree on river bank. As he crosses the river his flowers double. He offers some of them to the deity in the first temple and proceeds to second river. As he crosses second river his flowers double. He offers same number of flowers to deity in second temple and proceeds to third river. As he crosses third river his flowers double. He offers same number of flowers to deity in third temple and does not have any flower left. Now can you tell me how many flowers does he pluck from the tree and how many he offers to each deity?

The priest will pluck 7 flowers which will become 14 and then, he will offer 8 flowers to the first diety with 6 flowers remaining with him.

Simple one. But, let us approach mathematically.

Let us say, he plucks X flowers at first river, and offering Y flowers to the deity. As he cross the first river, he will have 2X flowers. After first offering he left with (2X – Y) flowers. Upon crossing second river, he will have (4X – 2Y) flowers. Again, donating Y flowers to second deity, he left with (4X – 3Y) flowers. After the last river, he will have (8X – 6Y) flowers with him. As it is equivalent to the flowers he is offering to deity, we have 8X – 6Y = Y or 8X = 7Y.

Any value of X and Y, satisfying the above ratio will solve the puzzle.