virtual one round 2nd round ftp person hr called me for first round was hr screening
2nd round was assessment 3rd round wasFace to face interview at office
qst Certainly! Here's a simplified example of a JavaScript-related interview question along with a possible solution. Keep in mind that interview questions can vary widely, and the emphasis might be on problem-solving, algorithmic thinking, or other skills.
**Question:**
Given an array of integers, write a function to find the maximum sum of any two adjacent numbers. If the array is empty or contains only one element, return that element.
**Example:**
Input: `[1, 2, 3, 4, 5]`
Output: `9` (as the maximum sum is achieved by adding 4 and 5)
**Solution:**
```javascript
function maxAdjacentSum(arr) {
if (arr.length <= 1) {
return arr.length === 1 ? arr[0] : 0;
}
let maxSum = arr[0] + arr[1];
for (let i = 1; i < arr.length - 1; i++) {
const currentSum = arr[i] + arr[i + 1];
maxSum = Math.max(maxSum, currentSum);
}
return maxSum;
}
const inputArray = [1, 2, 3, 4, 5];
const result = maxAdjacentSum(inputArray);
console.log(result); // Output: 9
```
This question assesses the candidate's ability to iterate through an array, make comparisons, and find a solution based on a specific condition. It also tests their understanding of edge cases. Keep in mind that interviews may cover a wide range of topics, so it's essential to be well-prepared for different types of questions.