Saturday, January 15, 2011

JAVA BAT : Array 1 Problems

In Array 1 section, these are simple Array based problems in which there is no use of loops to solve the problems. To solve these problems we should use simple array methods for example:

arr[0], arr[1].......a[n] to access the elements of array.
arr.length to get the number of elements in array.
int[] arr = int[n] to initialize array of n integers (n is length for array)
int[] num = {1,2,3,4};  to initialize array in which element of array will be 1,2,3 and 4

Array 1 Problems:
 firstLast6 sameFirstLast makePi
 commonEnd sum3 rotateLeft3
 reverse3 maxEnd3 sum2
 middleWay makeEnds has23
 no23 makeLast double23
 fix23 start1 biggerTwo
 makeMiddle plusTwo swapEnds
 midThree maxTriple frontPiece
 unlucky1 make2 front11

No comments:

Post a Comment