| | |
JAVA Expert Help me.. Write a function that accepts an array of integers and returns
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Oct 2007
Posts: 5
Reputation:
Solved Threads: 0
JAVA Expert Help me.. Write a function that accepts an array of integers and returns
0
#1 Oct 12th, 2007
Write a function that accepts an array of integers and returns the second largest integer in the array. Return -1 if there is no second largest.
The signature of the function is
public class bc
{
public static void main(String[] args){ }
int f(int[ ] a) { }
}
Examples:
if the input array is {1, 2, 3, 4} return 3
if the input array is {{4, 1, 2, 3}} return 3
if the input array is {1, 1, 2, 2} return 1
if the input array is {1, 1} return -1
if the input array is {1} return -1
if the input array is {} return -1
bc.java (Required code)
The signature of the function is
public class bc
{
public static void main(String[] args){ }
int f(int[ ] a) { }
}
Examples:
if the input array is {1, 2, 3, 4} return 3
if the input array is {{4, 1, 2, 3}} return 3
if the input array is {1, 1, 2, 2} return 1
if the input array is {1, 1} return -1
if the input array is {1} return -1
if the input array is {} return -1
bc.java (Required code)
Re: JAVA Expert Help me.. Write a function that accepts an array of integers and returns
0
#2 Oct 12th, 2007
![]() |
Similar Threads
- array help (C)
- Replacing duplicate integers in an array (C#)
- Sorting Algorithms using Time (C++)
- help me in this home work please (C++)
- Problem with moving integers to a single formatted string (C)
- need help on word counter (C++)
- Array problem (C)
- Need Help counting Array Length (C++)
Other Threads in the Java Forum
- Previous Thread: How to Find the Latitude and Longitude values from the Google Maps
- Next Thread: Java JButton problem
| Thread Tools | Search this Thread |
Tag cloud for Java
affinetransform android api apple applet application arc arguments array arrays automation binary bluetooth businessintelligence chat class classes client code component database desktop draw ebook eclipse encode equation error event exception file fractal game givemetehcodez graphics gui helpwithhomework html ide image input integer intersect j2me java javaexcel javaprojects jmf jni jpanel julia linked linux list loop mac main map method methods mobile netbeans newbie number online open-source oracle parameter print problem program programming project properties recursion reference replaysolutions rotatetext scanner score screen scrollbar server set size sms socket sort sql string superclass swing template test threads time tree windows working xstream






