You are not logged in. Please login at to post your questions!


Which language is better for competitive coding?

Which language is better for competitive coding? Given I already knew C and Java(only basic) and I code in C. but I am unable to improve performance.Please suggest me language with why that language is good.

asked 14 Jul '14, 10:21

himanshu_9419's gravatar image

accept rate: 18%

don't be so rude. Use any language, it doesn't matter which language you are using, until or unless your logic is correct


(15 Jul '14, 13:05) amitt0012★

@amitt001 I don't understand why you are saying rude but I have a suggestion for you. It seems to me that you think language does not matter at all than leave c++ and start submitting code in c. After having experience of submitting code in both language( not for easy level but for medium or hard one) than comment back. Please don't comment on thing which you don't know.

(15 Jul '14, 18:54) himanshu_94194★

If you know C and java than you can either move to C++ or java .

C++ : Less running time and STL library is available which is very good .

Java : It can handle big integers easily .

But you can choose any language , because if your algorithm is right than choice of language doesn`t matter much . Every code which can be done in C++ can also be done in java and vice - versa . It depends on you which language you find yourself comfortable take that language .

Happy Coding !!!


answered 14 Jul '14, 11:34

the65bit's gravatar image

accept rate: 13%

Thanks for answer.

(14 Jul '14, 12:46) himanshu_94194★
(14 Jul '14, 13:10) the65bit4★

If you are not going to participate in the ACM ICPC or the IOI you don't need java to handle big integers (which is the only reason some people use it even though they hate it), you can use python to do that even easier (by default).

(14 Jul '14, 18:16) vicfred3★

Hi @himanshu_9419

According to my research, people use c++ over c for stl

and C++ over Java for time of execution as it is less in c++ over Java...

Now coming,to C++ v/s Java...

I have found many of the universities teaches first C or C++ to the beginners or either most programmer begin with C++ over Java...which all points to be more flexible and enjoyable with C++...

Hope it helps!

Happy coding...:)


answered 14 Jul '14, 17:30

tech_boy's gravatar image

accept rate: 7%

@tech_boy thanks for answer

(14 Jul '14, 17:40) himanshu_94194★

you can accept it as well

@himanshu_9419 your welcome :)

(14 Jul '14, 17:47) tech_boy2★

Assuming that by competitive coding, you refer to ICPC or time-bound coding contests, mastery of C++ with a basic knowledge of Java will get you through it.

Most competitive programmers prefer C++ over C because of the in-built functions associated with it. In C++, you can simply use sort(a, a+n) to sort an array a[] of size n, or use lower_bound(a, a+n, num) to binary search a number instead of writing the entire code (imagine the benefits in a time bound contest). Moreover there are inbuilt data structures like vector (resizeable arrays), list, queue, stack, etc. in C++.

Java, albeit slower, has a powerful BigInteger, String Processing, HashTable and GregorianCalendar API. Suppose you have to calculate the factorial of 25 (the answer has 26 digits), creating a C/C++ code from scratch will take time and effort, whereas a Java solution is this:
BigInteger fac = new BigInteger.valueOf(1);
for (int i = 2; i <= 25; i++)
fac = fac.multiply(BigInteger.valueOf(i)); // wow :)
Bottomline: To actually excel in these contests, use better data structures and algorithms. No kidding. If you encounter a graph problem and you are not familiar with graphs, it doesn't really matter which language you are using.


answered 14 Jul '14, 19:21

michelangelo's gravatar image

accept rate: 39%

edited 21 Oct '14, 16:11

@michelangelo Thanks for answering in such detail.

(15 Jul '14, 10:23) himanshu_94194★

Excuse me brother,

By the way everything is relative in this world, there's nothing absolute. If you know a certain programming language get proficient in it because as long as a certain language is allowed for a problem, it means solving it is possible in that particular language so cool bro.


answered 21 Oct '14, 20:33

topcoder_7's gravatar image

accept rate: 9%

I think language does not matter much other than when you do submit code on SPOJ. I code in C# and if you have correct algorithm in place it will pass in all the coding contest like codechef , codeforces , hackerrank etc. I have only found that on SPOJ if the question has lot of input data C# do have the TLE issue otherwise C# also works great. Choose any language that you are comfortable with it . Sometime some language has in build functions but still you can manage in your own language


answered 14 Jul '14, 13:45

dev8546's gravatar image

accept rate: 0%

edited 14 Jul '14, 13:47

@dev8546 Thanks for Answer. I think language matters as a beginner because you can't optimize a code after some extent. What I see is C++ is used more than any other coding language I don't know why? But I want somebody to answer that why C++ is preferred over C, java and C#.

(14 Jul '14, 17:17) himanshu_94194★

Basically Language doesn't matter but the algorithm should be correct.Therefore codechef provides lots of languages of your choice.Every Language has its own benefits like C has good Time of execution over Java,Python but Java ,C++ or Python already has predefined functions which make coding faster.But at the end without algorithm languages doesn't matters here.I hope you get the point.


answered 14 Jul '14, 18:11

shivamsharma's gravatar image

accept rate: 0%

My friend I know this but you can't start everything from scratch at the time of contest.Write a code in c++ for hard problem than write it in C you will come to know you have wasted you lot of time in comparison to code writing in c++. Here I take c and C++ only for example.

(21 Oct '14, 20:51) himanshu_94194★
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:


question asked: 14 Jul '14, 10:21

question was seen: 19,699 times

last updated: 29 Sep '17, 17:05