Practice Real Company Assessment Patterns • Latest 2025–2026 Mock Tests

Programming Exercises

Write a function to find the second largest element in an array {12, 35, 1, 10, 34, 1}.

Medium

Problem Statement

Write a function to find the second largest element in an array {12, 35, 1, 10, 34, 1}.

Sample Input

12 35 1 10 34 1

Sample Output

Second largest element: 34

Limits

Time: 2s · Memory: 256 MB

Code Editor
00:00
#include <stdio.h> int secondLargest(int arr[], int n) { // Your code here } int main() { int arr[] = {12, 35, 1, 10, 34, 1}; printf("Second largest element: %d\n", secondLargest(arr, 6)); return 0; }
Log in or sign up to run or submit your code.Log inSign up
Input
12 35 1 10 34 1
Expected Output
Second largest element: 34