Welcome to the world of Geeks!!

How many times were you frustrated while looking out for a good collection of programming/algorithm/interview questions? What did you expect and what did you get? This portal has been created to provide well written, well thought and well explained solutions for selected questions.

### The Team:

Sandeep: A geek who loves solving programing problems in the most efficient ways. My areas of interests include Algorithms, Operating Systems and System Programming. You can follow me on twitter or facebook. My GeeksforGeeks profile http://www.geeksforgeeks.org/forums/users/sandeep/

Moderators:

Venki: An engineer graduated in ECE stream from GITAM, passionate about computers and problem solving. His interests include Algos & DS, Mathematics, Puzzles, Operating Systems, C++, Web/Big Data and reading regional Telugu literature. Connect him on LinkedIn, Facebook and Personal Blog.

Kartik: An IIT alumnus who loves programming, computer science and movies. His GeeksforGeeks profile: http://www.geeksforgeeks.org/forums/users/kartik/.

Aashish Barnwal: A CS Engineer pursuing graduation from KIIT University, Bhubaneswar, passionate about coding in most efficient way. My areas of interest include Data Structure & Algorithms, Compiler, Problem Solving, Mathematics and Puzzles. Facebook profile: http://www.facebook.com/barnwal.aashish

Narendra Kangralkar: An IT engineer graduated from Pune. I mostly spend my time with Linux and sharing resourceful knowledge with others. I also enjoy reading technical magazines and Marathi novels. My areas of interests includes Algorithms and Data-structures, Operating System, Linux system programming and Shell scripting.

Gautham: EEE graduate from NIT Warangal. Gautham no longer contributes to GeekstoGeeks. Currently working on a new initiative PPprep.

• Nitesh Vishnoi

1 + 2*3 + 3*4*5 + 4*5*6*7 + 5*6*7*8*9 +………..
print the product of the terms using recursion

• Chaviraj

add me to the team pleeeezzzzzzzz

• Ashish

• abhi

not only india but world

• Ajeet Kesarwani

hi …. many time i found … some question like j= ++a++a++a+++++a; this type of question are very confusing…. so how to solve this problem in more efficient way ..

• Anuj

Still waiting for Android App !!

• Harbinger

I’d like to inform the G4G team that a certain Narasimha Karumanchi has taken most of their code and text and passed it off as his own, in various books – from “Coding Interview Questions” to “Data Structures Made Easy”. He is also shamelessly promoting the precious work of so many people on this website as his own. Unless you have a monetary agreement with him, please look into it. You guys have not even been acknowledged in the book.

• Suresh

Great initiative! Hats off to you people!

• zealfire

@sanseep ,sir i too study at jiit sec-62(cse branch) knowing you are team member of geeksforgeeks really makes me proud

• Rohan Pota

#include

int main()
{
int i,j,k[10],l[10],m,n,o,p,flag=0,q;
scanf(“%d”,&i);
for(j=0;j<i;j++)
{
scanf("n%d %d",&k[j],&l[j]);
}
for(q=0,o=k[q];q<i,o<=l[q];o++,q++)
{
for(m=2;m<=l[q];m++)
{
if(o%m==0 && o!=m && o!=1 && m!=1)
{ flag=1; }
}
if(flag==0 && o!=1)
{ printf("n%d",o); }
}
return 0;
}

prog.c: In function ‘main’: prog.c:14:23: error: left-hand operand of
comma expression has no effect [-Werror=unused-value]
for(q=0,o=k[q];q

• Guest

#include

int main()
{
int i,j,k[10],l[10],m,n,o,p,flag=0,q;
scanf(“%d”,&i);
for(j=0;j<i;j++)
{
scanf("n%d %d",&k[j],&l[j]);
}
for(q=0,o=k[q];q<i,o<=l[q];o++,q++)
{
for(m=2;m<=l[q];m++)
{
if(o%m==0 && o!=m && o!=1 && m!=1)
{ flag=1; }
}
if(flag==0 && o!=1)
{ printf("n%d",o); }
}
return 0;
}

i got error on code chef saying::

prog.c: In function ‘main’: prog.c:14:23: error: left-hand operand of
comma expression has no effect [-Werror=unused-value]
for(q=0,o=k[q];q

• wine lover

• SAGAR PANT

i am taking two string as input.First one is single word and the second one is multiword string .But when the program executes it terminates after 1st input.Please help me on this and thanks in advance

• Neha .

Hi Team,

• Rick

hello world!

• Er Veer Singh

@geeksforgeeks:disqus Could you please provide the estimated time for below question ?

• Er Veer Singh

Under C++ Portal the Constructor and Destructor Portion is under maintenance . May I know How much time will it take to come back as previous stage ?

• student

which book is good for learning data structure programming and algorithms related to C?

• Vikrant

@geeksforgeeks:disqus Could you people make a tutorial on Binary Index Tree? I didn’t understand TopCoder tutorial on BIT. Thanks in advance.

• Vivek

@geeksforgeeks:disqus: I would be really helpful if Job openings are also included in the website.

• siren09

This is the best side for programming lovers who wants to learn…thanks for such a beautiful initiative and idea…it is my fav website

• Vinay

I would suggest to add all the data to a pdf

• Abhimanyu

Thanks for the good work. This site is great!!

• mohit_verma

@geeksforgeeks
how can i reset profile password on this portal ??

• GeeksforGeeks

mohit,
We have added a link to profile on top right corner (Below geeksquiz link). When you click on your user name, you will be redirected to your profile. On profile page, there is a link to edit you profile.

• mohit_verma

how can i reset my profile password on this portal??

``` ```
/* Paste your code here (You may delete these lines if not writing code) */
``` ```
• tarkik.mittal
``` ```
/* Paste your code here (You may delete these lines if not writing code) */
``` ```
• aayush agarwal

For this question do we have to break it into 3’s and take the last remainder if any and then product it.

A Geek has a rope of length L meters. He wants to cut the rope in different parts of integer lengths. The Geek wants to make cuts in a way that maximizes product of lengths of all parts. For example, if the Geek has a rope of length 10, the maximum product he can get is 36 by dividing the rope in three parts of lengths 3,3 and 4 How does he make cuts for a given rope of length L

• Ashish Mangla

Thanks geeksforgeeks for such a great work. It has helped me (and a lot many others) to prepare well for their dream jobs and achieve it also. When I came across this site I quickly realized that this site is going to help me in big way and so was done.

Once again thanks and I hope it will continue addition of new questions and go way ahead guiding not only professionals but also a bigger success platform for its owners.

• Rajesh

Hi Geeksforgeeks team,

One suggestion from my side is that the way questions are presented in the interview corner.When I open the link for a particular company , I get all the posts done by people on the forum for that company.But the problem is that , we only get the main heading of the question.We have to open the link ,after that only we get the exact question.I would suggest that ,we could be able to see the question from the main page itself ,instead of opening the link.It was like this, before the site up gradation took place.It will make browsing the questions easier.

``` ```
/* Paste your code here (You may delete these lines if not writing code) */
``` ```
• Dilip

good work….& thank you

• Anushree

Awesome work by Geeksforgeeks
hats off to the team
Thank you

• Jagat

Thanks for the whole repository of questions and organized portal for interview question.

I have a criticism though, regarding the articles I see here.
GFG does an extremely poor job in providing the intuition as to how they arrived at the solution.
One bad effect of not having the logical path to the solution is that the website users will tend to memorise the solutions, which will cause more harm than benefit in the long run, besides forgetting the solution itself shortly.

• Memorizing solutions is not at all recommended. GFG is not just an interview discussions forum. There are many articles beyond interview purpose. Our main focus is to present various problem solving strategies.

We would encourage the reader to try solution on their own, only then look at the solution. If anyone glances at solution he or she making damage to their skills improvement. If they find better solution, we would like to present the same on GFG to help other readers.

• vikas

Hi Geeksforgeeks team,

I wanted to know how do I get the company specific questions.Recently after the site’s ‘interview corner’ maintenance I am unable to browse company specific questions.Suppose I want to see all the questions posted by people on adobe interview , how do i access that like I used to before.

``` ```
/* Paste your code here (You may delete these lines if not writing code) */
``` ```
• GeeksforGeeks

@vikas: We are working on this and many other new features for interview corner. We will be updating you once these features are available. The interview corner is not in maintenance mode, it is available now.

• sumanyv

Is there a way to get a mail for each post/comment on geeksforgeeks to my personal gmail.

carrercup has an option for this, so it allows us to be up-to-date all the time and we will never loose track of the details.

I understand that this feature is there for AboutUs, but it would be great if this is there as a general setting for an account.

• How can I register?

• kartik

You do not need to register to comment on blog. For forum, you can use use the link given on top left of forum.

• algobard

I’m not able to post my comments/doubts anywhere!
The bar just scrolls up to the top of the page as soon as I hit submit. Whenever I repost the same comment it detects duplication…Yet I’m unable to see my comment anywhere! Are you guys moderating the comments?!

• GeeksforGeeks

@algobard: We have enabled comment moderation. We were getting many unrelated comments.

• Jagat

Thanks for the effort!

However, I would suggest you start implementing code for algorithm articles in Python instead of C++. Implementing code in C++ makes it much more elaborate and puts the focus on language rather than the algorithm itself.

On the other hand, when you implement it in Python, it looks exactly like the pseudo code and makes it much more readable.

• Kanhaiya Baranwal

Good Job Guys!

Keep the good work going.

• Hello sir,
Please update all G-facts on the G-facts section.
i will be greatly thankful to you.
i think you removed rest G-facts from the G-facts sectio.

• GeeksforGeeks

@Amit: We have moved most of the G-Facts to C/C++ puzzles category. The reason was to have a better readable titles. G-Facts are still there with different titles and categories.

• Thank you sir

• Jigsaw

There seems to be no good way to fetch all titles related to a specific company (search returns everything containing that keyword). It’ll be great if you could add some sort of “tags” feature, clicking on which will return results that we can then sort, based on time etc.

• Ramesh

Thank you so much… for wonderful work…
It helped me lot in understanding algorithms and data structures

• _Bunyip
``` ```
I love this site. Please continue doing this great work of helping others!!
``` ```
• Neethu S

Very nice site. I gone through different sites for gate questions with solutions. But none of them upto the mark. Some are asking for login. Really so thankful to all for your contributions. Expecting more gate related topics for cse.

• Aashish Barnwal

Thanks for your comment. We are working to improve it further.
Keep visiting the site.
Thanks you.

• ss

Hello GTG team,
i am about to join wipro for SAP but still for next one year i want to try for amazon,yahoo,ms.
so i wanted to ask that:
Ques> Companies like Amazon say fresher 0-2 can apply, so does it matter that whether the candidate is from SAP{or any other field that is not in Amazon} or is idle unemployed,
if candidate is in range 0-2 can simple apply and get the job?
Ques> once rejected by Amazon so after how much time we can apply again in it?

• Venki

Ohh… not reading GFG past few months, there are significant posts from readers. I am happy that our leisure time efforts helping many students and professionals. Great work, I appreciate creators of GFG for their idea.

These days not finding time to contribute. :(, hope others are filling the lacuna.

Venki — A moderator.

• Pravin
``` ```
/*
Very useful .....thanks..
*/
``` ```
• priso

very useful Thanks

``` ```
/* Paste your code here (You may delete these lines if not writing code) */
``` ```
• bikram

hello members i want to ask about Karthik ? Hey man are you Karthik Raghavan from IIT MS 2008 batch ??

``` ```
/* Paste your code here (You may delete these lines if not writing code) */
``` ```
• bikram

from IIT madras and senior/friend of Prasanna Karthik?

• geminisdb

After many not-so-reliable interview questions forums and reference books in pseudo-code, this site perfectly fitted my bill.
For bridging the gap between theory and practical implementation. Thank you !!

P.S: I love the syntax highlighting.

• geminisdb

After many not-so-reliable interview questions forums and reference books in pseudo-code, this site fitted my bill.
I am surprised how perfectly you bridge the gap between theory and practical implementation. Thank you !!

• Aashish Barnwal

Thanks for the comment. keep visiting the site.

• Venkatesh

I would like to appreciate your work. Really quality stuff. I learnt a lot from past 1 month.

I am not able to find good book on data structures and algorithms. can you suggest one book.

Thanks,
Venkatesh

• huwenchang7

Definite a great website, hope it can help me beat Amazon…

• pearls

Thanks to this site.. I cud crack Microsoft 😀

• Thanks for your comment. Keep visiting the site and contribute further.

• Good work guys. Appreaciate the effort.

• Brett Fank

• Ajeet

good work guys.

Plz post tutotrials of Trie,Suffix trees and String Matching algorithms like knuth Morris and Boyer-moore with running C Code and algo.

• nikhil jain

really thats much needed along with the applications of suffix tree and tries please post how to make such trees

• abc

Hey guys it’s been a long wait for the design patterns section :(….waiting for it.
Also segregating questions on OS would be really good! Keep up the good work…

• Gaurav

Hi, this website is really awesome.
I would suggest you to add all the data on this website in a pdf file. That would make easy for programmers to learn as they would get whole material at one place.

• Ramakrishna B

why do not u add some thing like “c/c++ program evaluation tool” to the site?

• Possibly the best site I’ve ever come across..Good show!

• rajeev

Its really a vgreat website..i hae found most of the important questions in this site.U could also include the facility for receiving questions on the mail on daily basis(10 to 20) depending on the request of the user,like data structure ,c ,os ,c ++. It would really be nice if u include this feature.

Thanks

• koushik C

Nice one …

Some of my suggestions ,

1. Tagging questions bases on company is very imp as people seek the types of questions each company ask .

2. To attract users who are exp , trying adding feedback to company profile , the kind of work they do etc

3. As you have started differnt page for topics like Arrays, Bitmagic , some notes from good books and other sites will help.

• JT

Hey guys, didn’t know about this until i saw the mail from Gautham. you guys will rockm, and go great lengths. all the best for your future, and i look forward to pointing this website to wannabe geeks for sure!

• super. thank u very much

• Manish jain

nice work

• Venki

Guys, good work, keep it up. Can we have one more sub-title for “Design Patterns”? May be it is bit advanced for beginners, yet many professionals are browsing the site.
Thank you, Venki.

• Gautham

Having Design Patterns is definitely a very good idea But we want to go in phases. After covering object oriented progrwmming, will be covering design patterns. Thanks for the suggestion.

• Venki

Good idea, step wise. Let us start discussion on Object Oriented Principles preferably SOLID and GRASP.

• Asit

Good work. But how about including solution in java too…please let me know where we can contribute solution in java…

• Gautham

Asit, posting solutions in java is a good thought. If you have solutions in Java, you can add them in comments of the individual posts.

We are considering adding Java solutions to the main posts, but is not in our priority list due to the effort involved.

• Vishwa Jeet

Hi Sandeep,

Very good work….keep continue this good work…

• GeeksforGeeks

For a C++ query, select forum category as “C/C++ Programming Questions”

• deepak

Hey tell me sandeep how do I post queries of C++

• GeeksforGeeks

@sachin: Sachin, GeeksforGeeks was born out of the experience of three technology passionate guys with different backgrounds.

Sandeep used to work in a big MNC before he left to pursue his passion in teaching. Gautham, who graduated in Electrical and Electronics Engineering, now works as a software developer in a famous MNC. Calvin contributes to the website whenever he has a free time or during his journey to China, India or a European country.

• sachin

Good website guys . Just out of curiosity r u guys students or professionals ?

• geeky

Great work guys. god speed.

• Naveen

I agree. Love you guys.

• Good job, keep up the nice work

• Siri

Hey!
this is an awesome site..efficient and clearly explained solutions, keep it up guys!

• amit

nice website very very useful

• bhupi

2 guys and a geek.
lolz.

• raja

yeah.. really very useful website.., throughout my 3 years googling…

• Mini

Hey..awesome site.
has been very helpful. If I crack my placement interviews it would be because of geeksforgeeks

Thanks!

• prateek
``` ```
/* Paste your code here (You may delete these lines if not writing code) */
``` ```
• Very useful and instructive site!
Keep up the efforts!