public static int f (int []a, int []b,int []c)
{
final int N=a.length;
int j, k=0, g=0, t=0 ;
for(int i=0;i<N;i++)
{
for (j=0;j<N;j++)
if (b[j]==a[i])
break;
if (j==N)
{
c[t]=a[i];
if (g==0 || c[t]>k)
{
k=c[t];
g=1;
}
t++;
}
}
return k;
kbondarchuk
0
Newbie Poster
Recommended Answers
Jump to PostHere's a little example:
public class A { public static void main(String a[]){ print("Hello World."); } public static void print(String str){ System.out.println(str); } }
You'll have to include your main function, and your own function into a class. In Java everything has to be an Object/class, …
Jump to PostA small point:
although the declaration syntaxint arr[]
is perfectly valid, most standards prefer the formint[] arr
That's the form you will find throughout the Java API source code.
The reason is that arr is an array of ints, as implied by the second form. The first form …
All 8 Replies
kbondarchuk
0
Newbie Poster
NP-complete
42
Junior Poster
Lucaci Andrew
140
Za s|n
kbondarchuk
0
Newbie Poster
subramanya.vl
0
Junior Poster in Training
jalpesh_007
-3
Newbie Poster
Lucaci Andrew
140
Za s|n
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.