Update appNew update is available. Click here to update.
About
My Stats
EXP gained
yellow-spark
0
Level
1 (Apprentice)
Community stats
Discussions
0
Upvotes
0
Know more
0
Total problems solved
0
Easy
0
Moderate
0
Hard
0
Ninja
Jan Jan Feb Feb Mar Mar Apr Apr May May Jun Jun Jul Jul Aug Aug Sep Sep Oct Oct Nov Nov Dec Dec

Current streak:

0 days

Longest streak:

1 day

Less

More

Discussions
My solution which is not running in the code studio , i don't think so my code is wrong ,but you can also check it.
Interview problems

public static int findSecondLargest(int n, int[] arr) {

    for(int i =0; i<arr.length-1; i++){

        for(int j =i+1; j< arr.length-1;j++){

            if(arr[i]<arr[j]){

                arr[i]= arr[j];

                arr[j]= arr[i];

            }

        }

    }   

    

    for(int i : arr){

        if(arr[i]>arr[i+1]){

            

            return arr[i+1];

        }

    }

 

    return -1;

    }

}

profile
Lovepreet Singh
Published On 30-Oct-2023
93 views
1 replies
0 upvotes
my solutions??
Interview problems

 I think my solutions is accurate , i just had implemented distinct approach as i first sorted the array big  number to small ones, and then applied again for getting the required answer. 

profile
Lovepreet Singh
Published On 30-Oct-2023
32 views
0 replies
0 upvotes