Add office photos
Employer?
Claim Account for FREE

Facebook

4.4
based on 158 Reviews
Filter interviews by

Acme Generics LLP Interview Questions and Answers

Updated 5 Feb 2024
Popular Designations

Q1. Given an “id” and a function getFriends(id) to get the list of friends of that person id, write a function that returns the list of “friends of friends” in the order of decreasing number of mutual friends, as i...

read more
Ans.

Function to return list of friends of friends in decreasing order of mutual friends

  • Use a set to store all friends of friends

  • Iterate through the list of friends of the given id

  • For each friend, iterate through their list of friends and count mutual friends

  • Sort the set of friends of friends by decreasing number of mutual friends

Add your answer

Q2. Given two “ids” and a function getFriends(id) to get the list of friends of that person id, write a function that returns the list of mutual friends

Ans.

Function to return mutual friends given two ids and getFriends(id) function

  • Call getFriends(id) for both ids to get their respective friend lists

  • Iterate through both lists and compare to find mutual friends

  • Return the list of mutual friends

View 2 more answers

Q3. Given a number of time slots – start time and end time,“a b”, find any specific time with the maximum number of overlapping. After solving the problem I had to prove my solution

Ans.

Given time slots, find a specific time with maximum overlap. Prove solution.

  • Create a list of all start and end times

  • Sort the list in ascending order

  • Iterate through the list and keep track of the number of overlaps at each time

  • Return the time with the maximum number of overlaps

  • Prove solution by testing with different input sizes and edge cases

Add your answer

Q4. You have a number of incoming Integers, all of which cannot be stored into memory. We need to print largest K numbers at the end of input

Ans.

Use a min-heap to keep track of the largest K numbers seen so far.

  • Create a min-heap of size K.

  • For each incoming integer, add it to the heap if it's larger than the smallest element in the heap.

  • If the heap size exceeds K, remove the smallest element.

  • At the end, the heap will contain the largest K numbers in the input.

Add your answer
Discover Acme Generics LLP interview dos and don'ts from real experiences

Q5. Given an array of Integers, find the Longest sub-array whose elements are in Increasing Order

Ans.

Find the longest sub-array with increasing order of integers.

  • Iterate through the array and keep track of the current sub-array's start and end indices.

  • Update the start index whenever the current element is smaller than the previous element.

  • Update the end index whenever the current element is greater than or equal to the next element.

  • Calculate the length of the sub-array and compare it with the longest sub-array found so far.

  • Return the longest sub-array.

Add your answer

Q6. Given a Sorted Array which has been rotated, write the code to find a given Integer

Ans.

Code to find a given integer in a rotated sorted array.

  • Use binary search to find the pivot point where the array is rotated.

  • Divide the array into two subarrays and perform binary search on the appropriate subarray.

  • Handle edge cases such as the target integer not being present in the array.

Add your answer

Q7. Given an array of Integers, find the length of Longest Increasing Subsequence and print the sequence.

Ans.

Find the length of longest increasing subsequence and print the sequence from an array of integers.

  • Use dynamic programming to solve the problem

  • Create an array to store the length of longest increasing subsequence ending at each index

  • Traverse the array and update the length of longest increasing subsequence for each index

  • Print the sequence by backtracking from the index with the maximum length

  • Time complexity: O(n^2)

  • Example: Input array [3, 4, -1, 0, 6, 2, 3], output length 4 a...read more

Add your answer

Q8. Implement LRU Cache

Ans.

LRU Cache is a data structure that stores the most recently used items and discards the least recently used items.

  • Use a doubly linked list to keep track of the order of items in the cache

  • Use a hash map to store the key-value pairs for fast access

  • When an item is accessed, move it to the front of the linked list

  • When the cache is full, remove the least recently used item from the back of the linked list and the hash map

Add your answer
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.3
 • 36 Interview Questions
3.4
 • 29 Interview Questions
3.8
 • 26 Interview Questions
3.7
 • 22 Interview Questions
3.5
 • 16 Interview Questions
4.0
 • 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