Add office photos
Employer?
Claim Account for FREE

Riverbed Technology

3.9
based on 33 Reviews
Filter interviews by

MG Motor Interview Questions and Answers

Updated 5 Feb 2024

Q1. How will you rotate matrix by 90 degrees clockwise and anticlockwise?

Ans.

To rotate a matrix by 90 degrees clockwise, transpose the matrix and then reverse each row. To rotate anticlockwise, reverse each row and then transpose.

  • Transpose the matrix by swapping elements at (i, j) with (j, i)

  • Reverse each row of the transposed matrix

  • To rotate anticlockwise, reverse each row of the original matrix and then transpose

Add your answer

Q2. Two lines with 10 and 12 points, how many triangles possible?

Ans.

There are 3 possible triangles that can be formed using the two lines.

  • To form a triangle, we need three points.

  • With two lines, we have a total of four points.

  • By choosing any three points, we can form a triangle.

  • Therefore, there are 3 possible triangles.

Add your answer

Q3. If the element not present return the nearest element to it?

Ans.

The question is asking for a solution to find the nearest element to a given element in an array.

  • Iterate through the array and calculate the absolute difference between each element and the given element.

  • Keep track of the minimum difference encountered and the corresponding element.

  • Return the element with the minimum difference as the nearest element.

Add your answer

Q4. Identify most recent duplicate ? {"google","yahoo","yahoo","google"}-both google and yahoo are repeated but google is first return index 3

Ans.

Identify the most recent duplicate in an array of strings.

  • Iterate through the array and keep track of the indices of each string using a hashmap.

  • If a string is already present in the hashmap, update its index.

  • After iterating through the array, find the string with the highest index in the hashmap.

Add your answer
Discover MG Motor interview dos and don'ts from real experiences

Q5. How will you compress images?(Told 3 methods)

Ans.

There are three common methods to compress images: lossless compression, lossy compression, and resizing.

  • Lossless compression reduces file size without losing any image quality. Examples include PNG and GIF formats.

  • Lossy compression reduces file size by discarding some image data. Examples include JPEG format.

  • Resizing reduces file size by changing the dimensions of the image. It can be done manually or using image processing libraries.

Add your answer

Q6. Return the element k from a BST

Ans.

The function should return the element k from a Binary Search Tree (BST).

  • Traverse the BST in-order and keep track of the current element

  • If the current element is equal to k, return it

  • If the current element is greater than k, move to the left subtree

  • If the current element is less than k, move to the right subtree

  • Repeat until the element is found or the entire tree is traversed

Add your answer

More about working at Riverbed Technology

HQ - San Francisco, California, United States Of America
Contribute & help others!
Write a review
Share interview
Contribute salary
Add office photos
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Top Software Engineer Interview Questions from Similar Companies

3.8
 • 155 Interview Questions
4.1
 • 26 Interview Questions
3.7
 • 22 Interview Questions
4.0
 • 15 Interview Questions
3.9
 • 14 Interview Questions
3.9
 • 10 Interview Questions
View all
Share an Interview
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
70 Lakh+

Reviews

5 Lakh+

Interviews

4 Crore+

Salaries

1 Cr+

Users/Month

Contribute to help millions
Get AmbitionBox app

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter