Question 1: Find the Second Largest Element
Given an array of integers, find the second largest element.
Input
Output
Example
Largest = 25
Second Largest = 20
Concepts
- Arrays/Lists
- Loops
- Conditions
Question 2: Count Frequency of Elements
Given an array, count how many times each element appears.
Input
arr = [1, 2, 2, 3, 1, 2, 4]
Output
{
1: 2,
2: 3,
3: 1,
4: 1
}
Concepts
Question 3: Check Palindrome Number
Given a number, check whether it is a palindrome.
Input
Output
Input
Output
Concepts
- Loops
- Modulus (%)
- Integer Operations
Question 4: Find Missing Number
An array contains numbers from 1 to n with one number missing.
Find the missing number.
Input
Output
Hint
Expected numbers:
Actual numbers:
Missing:
Concepts
Interview Bonus
Reverse an Array
Input
Output
Find Maximum Element
Input
Output
Count Even and Odd Numbers
Input
Output
Sum of Digits
Input
Output
Question 1: Find the Second Largest Element
Given an array of integers, find the second largest element.
Input
Output
Example
Concepts
Question 2: Count Frequency of Elements
Given an array, count how many times each element appears.
Input
Output
{ 1: 2, 2: 3, 3: 1, 4: 1 }Concepts
Question 3: Check Palindrome Number
Given a number, check whether it is a palindrome.
Input
Output
Input
Output
Concepts
Question 4: Find Missing Number
An array contains numbers from 1 to n with one number missing.
Find the missing number.
Input
Output
Hint
Expected numbers:
Actual numbers:
Missing:
Concepts
Interview Bonus
Reverse an Array
Input
Output
Find Maximum Element
Input
Output
Count Even and Odd Numbers
Input
Output
Sum of Digits
Input
Output