BETA

FAQ : Frequently Asked Questions


Our Motto:

Practice is a well designed interface intended to be “One stop”’ for practicing all kinds of coding problems. It is especially designed to practice coding problems on the topic you wish to. Be it “an interview based question” or “a simple array program”, we plan to keep all of them under one umbrella.

1) What is Competitive programming and how does it help in placements?

Competitive programming is solving well-defined problems by writing computer programs under specified limits. On this practice platform too, you are required to write code under various restrictions, like execution time and memory limits for your program. Also, you are required to solve maximum number of problems in a predetermined time frame. It prepares you for the real scenario when you will actually be landing up for an interview.

2) How to write my first program in Competitive programming Environment?

Please see How to begin with Competitive Programming?

3) How should I begin using GeeksforGeeks Practice, I am new to coding?

Step 1:

Begin with solving the Basic Problems like arrays, strings and subsequently continue to easy, medium and hard levels. If you feel that you are unable to solve them, look at the editorials available. Or you may begin with learning concepts first. Refer to basic tutorials like C, Data Structures, Algorithms for learning concepts and begin practicing coding problems thereafter. You may also use our IDE in case you do not wish to track your progress as of now.

Step 2:

Once you are through with the basic problems, move onto the Easy level. If at any point of time you feel that you are not able to solve the problems , please refer editorials or ask a question in Q&A to discuss your doubt amongst other geeks.

4) How do I track which problems I've solved till now?

You can practice as many problems as you want without creating a login. But, if you wish to track your progress and rank amongst other programmers, you will have to login or register. This user name and password will work on all GeeksforGeeks sub domains - IDE, Q&A , Practice.

5) What happens if I click on Editorial section ?

You will be redirected to the detailed explanation and solution to the given problem. Click on Editorial only if you are not able to solve the problem on your own.

6) How is IDE different from Practice?

IDE is meant for any problem you would like to solve using an online compiler whereas Practice platform provides well designed topic and company wise problems .

7) How does the time limit work?

Every problem has an associated maximum allowed time which is called time limit for the problem. 

8) My code compiles on my machine, but it is getting compilation error here.

One common reason is difference in compilers.  For example, some C compilers have compiler specific  header files and functions.  Like Turbo C supprts "conio.h", getch() and "clrscr()".  These are not supported in many other compilers.   There may be differences between versions of language standards implemented by different compilers.  For example, one compiler might be following C99 and other might be following C11.

9) Why I am getting error- Time Limit Exceeded? How exactly it works?

Time Limit Exceeded means your code has taken more time than maximum allowed time for a given problem.   Reasons could be, infinite or nlong running loops or inefficient approach.

10) The output produced by "Expected Output" is same as my program, but when I submit my program, I see "Wrong"

Testing your code for multiple test cases can help in identifying the problem in your code.

Mostly, the problem happens due to the following two cases:

  • Unset temporary variables: Reset all the temporary variables for each test case.
  • Due to missing new line:  Make sure that you have used " " or language specific new line character after output of every test case.

11) How to handle runtime errors in C/C++?

In C/C++ Compiler doesn't produce proper error message for runtime errors.  Following are common reasons we can check our code for.

1) Accessing array out of bound.  Example  "int arr[4];  arr[5] = 10;" 
2) Writing a read only memory. Example "char *str = "GfG"; str[1] = 'F';".  See this for details.
3) NULL pointer issues like accessing value at NULL or dereferencing an invalid memory. Example "int *ptr; *ptr = 10;"  See this for details.

Some Common Errors produced by our system:

  • Wrong! Your output more than Expected !!: Suppose, the number of test cases for a problem are 1000, then a program should print output for 1000 test cases (in the specified number of lines), neither less nor more. In case a program is producing more number of lines than Expected/Required, this error is encountered.
  • Wrong! Your output less than Expected !!: Suppose, the number of test cases for a problem are 1000, then a program should print output for 1000 test cases (in the specified number of lines), neither less nor more. In case a program is producing less number of lines than Expected/Required, this error is encountered.
  • String reading from stream: In case of problems requiring reading strings with spaces, characters leftover in buffer cause incorrect results.
    • For C/C++, use of scanf(" %[^ ]",s) is advised.(Note: There is an intentional space between " and % which tells scanf to ignore preceding whitespace characters.). Also refer this for more ways of handling buffers.
    • For Java, use of BufferedReader is advised.
    • For Python, use of strip() method along with raw_input() is advised.
  • NoSuchElementException: This is a Java specific error, when your code tries to read input more than available, such an Exception is thrown. Use of hasNext family of methods is advisable.

12) How is ranking done on Practice?
Ranking is done based on individual scores.  Score of a candidate is evaluated using below formula.

Score = ( Number of Successful School Submissions * 0) + ( Number of Successful Basic Submissions * 1) + ( Number of Successful Easy Submissions * 2) + ( Number of Successful Medium Submissions * 4) + ( Number of Successful Hard Submissions * 8)

13) How do function problems work?
In function problems, code written by users is appended to a pre-written code in case of Java/C/C++,  and pre-pended to a pre-written code in case of Python. 

14) Can I see the code which is appended/pre-pended to my code?
There are links provided above the editor for different languages. You can click on a language to see the code with which your code is concatenated.

Have any other Question? Click Here to ask a question.

15) When I am trying to login, it says that I have not confirmed my email. What to do?

To complete the registration process, you have to confirm your email address while you are logged in. Now, since you had not confirmed it then, you are logged out of your account. In such a case, the system will send you a new mail with the confirmation link. Click on it to confirm your email.

16) Why some links appear in orange color?
Orange color links are links already visited by you in your current browser.  These are stored in your browser's cache or local storage.