Is using `int` more preferable than using `unsigned int`?

Why is Integer array [] preferred over an int array [] in java in competitive programming? Is there any difference in performance as one of my solution using the primitive int gave TLE while using the object array was AC?

  • The program contained only Arrays.sort(array) method apart from an O(n) algorithm.

  • Answer:

    An integer array is preffered over an int array as integer is a wrapper class in java which helps us to store both characters and numerics.. it acts as an intermediate like in case of insertion of price in a text box where the values entered are treated like string.. and then converted to numeric equivalent.. this is not possible with int.. however it has a disadvantage.. the integer is a class in java and creates objects and memory is taken to instantiate all the class members and functions.. which is not the case with int.. hence it increases the execution time..

Karan Kapoor at Quora Visit the source

Was this solution helpful to you?

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.