Add office photos
Employer?
Claim Account for FREE

Google

4.4
based on 1.7k Reviews
Video summary
Proud winner of ABECA 2024 - AmbitionBox Employee Choice Awards
Filter interviews by

30+ Ananya Technologies Interview Questions and Answers

Updated 12 Nov 2024
Popular Designations

Q1. Painter's Partition Problem Statement

Given an array/list representing boards, where each element denotes the length of a board, and a number ‘K’ of available painters, determine the minimum time required to pa...read more

Ans.

Determine the minimum time required to paint all boards with given constraints.

  • Use binary search to find the minimum and maximum possible time to paint all boards.

  • Iterate through the boards and assign them to painters based on the time constraints.

  • Calculate the total time taken to paint all boards with the assigned painters.

View 1 answer

Q2. Special Numbers Problem Statement

Your task is to find the total count of special numbers within a range from 1 to a given integer, 'MAXVAL'. A special number is defined as a number whose digits, when rotated 1...read more

Ans.

Count the total number of special numbers within a given range by rotating digits 180 degrees.

  • Create a function to check if a number is a special number by rotating its digits.

  • Iterate through the range from 1 to MAXVAL and count the special numbers.

  • Handle the digit rotation mapping for 0, 1, 6, 8, 9.

  • Return the count of special numbers for each test case.

Add your answer

Q3. Chocolate Distribution Problem

You are given an array/list CHOCOLATES of size 'N', where each element represents the number of chocolates in a packet. Your task is to distribute these chocolates among 'M' stude...read more

Ans.

Distribute chocolates among students to minimize the difference between the largest and smallest number of chocolates.

  • Sort the array of chocolates.

  • Use sliding window technique to find the minimum difference between the largest and smallest number of chocolates.

  • Return the minimum difference as the output.

Add your answer

Q4. Say you have three tables WORK, USERS, MANAGERS WORK - work_id - user_id - how_much USERS - user_id - team MANAGERS - manager_id - team If I am a manager, write a select statement to retrieve the work of all us...

read more
Ans.

Write a select statement to retrieve work of all users who belong to my team.

  • Join USERS and WORK tables on user_id

  • Join MANAGERS and USERS tables on team

  • Filter by manager_id

Add your answer
Discover Ananya Technologies interview dos and don'ts from real experiences

Q5. Minimum and Maximum Candy Cost Problem

Ram is in Ninjaland, visiting a unique candy store offering 'N' candies each with different costs. The store has a special offer: for every candy you purchase, you can tak...read more

Ans.

Find minimum and maximum cost to purchase all candies with special offer of free candies.

  • Iterate through the candy costs array and sort it in ascending order.

  • For minimum cost, start from the lowest cost candy and take free candies until reaching the next higher cost candy.

  • For maximum cost, start from the highest cost candy and take free candies until reaching the next lower cost candy.

Add your answer

Q6. Problem Statement: Minimize the Maximum

You are given an array of integers and an integer K. For each array element, you can adjust it by increasing or decreasing it by a value of K. Your goal is to minimize th...read more

Ans.

Given an array of integers and an integer K, minimize the difference between the maximum and minimum elements after adjusting each element by +/- K.

  • Sort the array in non-decreasing order.

  • For each element, calculate the difference between the current element and the next element.

  • Adjust the element by adding or subtracting K to minimize the difference.

  • Return the minimum possible difference between the maximum and minimum elements.

Add your answer
Are these interview questions helpful?

Q7. Shopping Spree Problem Statement

Preeti plans to shop for her father's birthday at a store with unlimited quantities of N different items. She has a budget that allows her to buy a maximum of K items. Help Pree...read more

Ans.

Calculate the number of ways Preeti can purchase items within budget, considering distinct ways.

  • Use dynamic programming to calculate the number of ways to purchase items within budget

  • Consider different scenarios where Preeti buys different quantities of each item

  • Return the result modulo 10^9 + 7 to handle large answers

Add your answer

Q8. Farthest Distance From Lands Problem Statement

Given a binary square matrix 'ARR' with 'N' rows and 'N' columns, where '0' represents water and '1' represents land.

Determine the water cell whose distance to th...read more

Ans.

Find the water cell farthest from land in a binary matrix using Manhattan distance.

  • Iterate through the matrix to find all land cells and water cells

  • Calculate the Manhattan distance of each water cell to the nearest land cell

  • Return the maximum distance found

Add your answer
Share interview questions and help millions of jobseekers 🌟

Q9. Bridge in Graph Problem Statement

Given an undirected graph with V vertices and E edges, your task is to find all the bridges in this graph. A bridge is an edge that, when removed, increases the number of conne...read more

Ans.

Find all the bridges in an undirected graph.

  • Use Tarjan's algorithm to find bridges in the graph.

  • A bridge is an edge whose removal increases the number of connected components.

  • Check for bridges by removing each edge and checking the number of connected components.

  • Return the edges that are bridges in non-decreasing order.

Add your answer

Q10. Covid Vaccination Distribution Problem

As the Government ramps up vaccination drives to combat the second wave of Covid-19, you are tasked with helping plan an effective vaccination schedule. Your goal is to ma...read more

Ans.

Given constraints, find max vaccines administered on a specific day during a vaccination drive.

  • Iterate through each test case and calculate the maximum number of vaccines distributed on the specified day.

  • Distribute vaccines evenly across days while maximizing the number on the specified day.

  • Ensure that the sum of vaccines administered does not exceed the maximum allowed.

  • Consider edge cases like when the number of days is equal to the maximum number of vaccines available.

Add your answer

Q11. Alien Dictionary Problem Statement

You are provided with a sorted dictionary (by lexical order) in an alien language. Your task is to determine the character order of the alien language from this dictionary. Th...read more

Ans.

Given a sorted alien dictionary, determine the character order of the alien language.

  • Create a graph data structure to represent the relationships between characters based on the given dictionary.

  • Perform a topological sort on the graph to determine the character order of the alien language.

  • Return the character array obtained from the topological sort as the final output.

Add your answer

Q12. Count Ways to Reach the N-th Stair Problem Statement

You are provided with a number of stairs, and initially, you are located at the 0th stair. You need to reach the Nth stair, and you can climb one or two step...read more

Ans.

Count the number of distinct ways to climb to the Nth stair by climbing one or two steps at a time.

  • Use dynamic programming to solve the problem efficiently.

  • The number of ways to reach the Nth stair is the sum of the number of ways to reach the (N-1)th stair and the (N-2)th stair.

  • Handle base cases where N=0 and N=1 separately.

  • Apply modulo 10^9+7 to avoid overflow in the final result.

Add your answer

Q13. Problem: Ninja's Robot

The Ninja has a robot which navigates an infinite number line starting at position 0 with an initial speed of +1. The robot follows a set of instructions which includes ‘A’ (Accelerate) a...read more

Ans.

Determine the minimum length of instruction sequence for a robot to reach a given target on an infinite number line.

  • Start at position 0 with speed +1, update position and speed based on 'A' and 'R' instructions

  • For each test case, find the shortest sequence of instructions to reach the target

  • Consider both positive and negative positions for the robot

Add your answer

Q14. Swap And Maximize Problem Statement

You are given a circular array consisting of N integers. Your task is to find the maximum sum of the absolute differences between adjacent elements by rearranging the array e...read more

Ans.

Find the maximum sum of absolute differences between adjacent elements in a circular array by rearranging the elements.

  • Sort the array in non-decreasing order.

  • Alternate between picking the smallest and largest elements to maximize the sum of absolute differences.

  • Calculate the sum of absolute differences between adjacent elements in the rearranged array.

Add your answer

Q15. a / b c / / d e f g Print the nodes in the following order: a, b, c, g, f, e, d, h, i, j, k, l ,m, n, o and so on. Which all data structures are used? Can we use just 1?

Ans.

Multiple data structures are used to print nodes in a specific order. One data structure cannot be used alone.

  • The given order suggests a depth-first search traversal of a tree-like structure.

  • A stack can be used to keep track of the nodes to be visited.

  • A queue can be used to store the children of a node in the order they are visited.

  • An array can be used to store the nodes in the required order.

  • A linked list can be used to connect the nodes in the required order.

  • Using just one ...read more

Add your answer

Q16. Connecting Ropes with Minimum Cost

You are given 'N' ropes, each of varying lengths. The task is to connect all ropes into one single rope. The cost of connecting two ropes is the sum of their lengths. Your obj...read more

Ans.

Connect ropes with minimum cost by merging two smallest ropes at a time.

  • Sort the array of rope lengths in ascending order.

  • Merge the two smallest ropes at a time and update the cost.

  • Repeat until all ropes are merged into one.

  • Return the total cost as the minimum cost to connect all ropes.

Add your answer

Q17. If you had an opportunity to design the Google Suggest system, please let us know how you would approach it and how you would execute the plan in terms of settings up systems like(data stores or databases, inde...

read more
Ans.

Designing Google Suggest system

  • I would start by analyzing user search patterns and frequently searched keywords

  • Then, I would create a database of these keywords and their associated search results

  • I would use indexing services to quickly retrieve relevant results for each keyword

  • I would also implement machine learning algorithms to improve the accuracy of suggestions over time

Add your answer

Q18. Given n pens and n tops, each pen (and each top) having a size different than the other and each pen fitting exactly one top, find the largest pen using minimum number of comparisons. A comparison involves pick...

read more
Ans.

Find largest pen using minimum comparisons with tops.

  • Divide pens into two groups and compare largest pen from each group with largest top.

  • Repeat the process with the group containing the largest pen until only one pen is left.

  • The remaining pen is the largest pen.

  • Total number of comparisons required is 2n-3.

Add your answer

Q19. How do you find out if a number is a power of 2? And how do you know if it is an odd number? Write code in the language of your choice

Ans.

Check if a number is a power of 2 and odd.

  • To check if a number is a power of 2, use bitwise AND operator with the number and its predecessor. If the result is 0, it is a power of 2.

  • To check if a number is odd, use modulus operator with 2. If the result is 1, it is odd.

  • Example code in Python:

  • def is_power_of_two(num):

  • return num & (num - 1) == 0

  • def is_odd(num):

  • return num % 2 == 1

View 2 more answers

Q20. Given a source array of integers with possible duplicates and a target integer, write algorithm to find out 2 numbers in source array whose sum is equal to target integer

Ans.

Algorithm to find 2 numbers in an array whose sum is equal to a target integer

  • Use a hash table to store the difference between target and each element in the array

  • Iterate through the array and check if the current element exists in the hash table

  • Return the pair of elements that sum up to the target integer

View 1 answer

Q21. Given n dice, each of 'a' sides and a sum b, return the number of ways in which the sum b can be obtained. How can you reduce the time complexity and space complexity?

Ans.

Given n dice with 'a' sides and sum b, return no. of ways to obtain b. Optimize time and space complexity.

  • Use dynamic programming to reduce time complexity

  • Create a 2D array to store the number of ways to obtain each sum for each number of dice

  • Use rolling arrays to optimize space complexity

  • Example: n=2, a=6, b=7 -> 6 ways to obtain sum 7

  • Example: n=3, a=4, b=8 -> 21 ways to obtain sum 8

Add your answer

Q22. Which is faster: finding an item in a hashtable or in a sorted list? And Why?

Ans.

Hashtable is faster for finding an item than a sorted list.

  • Hashtable has constant time complexity O(1) for finding an item.

  • Sorted list has logarithmic time complexity O(log n) for finding an item.

  • Hashtable uses hashing to directly access the item's location.

  • Sorted list requires binary search to find the item's location.

  • Hashtable is ideal for large datasets with frequent lookups.

  • Sorted list is ideal for datasets that require frequent insertions and deletions.

View 2 more answers

Q23. Given 2 machines, each having 64 GB RAM, containing all integers (8 byte), sort the entire 128 GB data. You may assume a small amount of additional RAM. Extend this to sort data stored in 1000 machines

Ans.

Sort 128 GB data on 2 machines with 64 GB RAM each. Extend to 1000 machines.

  • Use external sorting algorithm like merge sort or quick sort

  • Divide data into smaller chunks and sort them individually

  • Merge sorted chunks using additional RAM

  • For 1000 machines, use distributed sorting algorithms like MapReduce or Hadoop

  • Ensure data consistency and fault tolerance in distributed sorting

Add your answer

Q24. In google adwords there are about 30 million ads from 42 lanuages . What will I do review the ads and reject ads that do not comply with specific rules

Ans.

Reviewing 30 million ads from 42 languages in Google AdWords and rejecting non-compliant ads requires a systematic approach.

  • Create a set of specific rules and guidelines for ad compliance

  • Use automated tools to filter out ads that violate the rules

  • Assign a team of reviewers to manually check the remaining ads

  • Ensure that the reviewers are fluent in the languages of the ads they are reviewing

  • Regularly update the rules and guidelines to keep up with changes in the industry

  • Provide...read more

Add your answer

Q25. How would you change the format of all the phone numbers in 1000 static html pages?

Ans.

Use a script to iterate through each HTML page, locate phone numbers, and update their format.

  • Write a script using a programming language like Python or JavaScript to iterate through each HTML page

  • Use regular expressions to locate phone numbers in the pages

  • Update the format of the phone numbers as needed (e.g. adding country code, changing separators)

  • Save the updated HTML pages with the new phone number format

Add your answer

Q26. What are some of the most popular Data interchange formats when using APIs

Ans.

JSON and XML are the most popular data interchange formats when using APIs.

  • JSON (JavaScript Object Notation) is a lightweight format that is easy to read and write. It is widely used in web APIs.

  • XML (Extensible Markup Language) is a more complex format that is also widely used in web APIs.

  • Other formats include CSV (Comma Separated Values), YAML (YAML Ain't Markup Language), and Protocol Buffers.

View 1 answer

Q27. How will improve the revenue of the cafeteria of the office.

Ans.

By introducing new menu items, optimizing pricing strategy, and improving the overall dining experience.

  • Conduct a survey to understand the preferences of employees

  • Introduce healthy and affordable meal options

  • Offer discounts for bulk orders or loyalty programs

  • Partner with local vendors to source fresh ingredients

  • Improve the ambiance and seating arrangements

  • Implement online ordering and delivery services

Add your answer

Q28. Name some popular APIs for each of these Social Commerce service(llike a photo service etc)

Ans.

Popular APIs for Social Commerce services

  • Facebook Graph API for social media integration

  • Instagram API for photo sharing and tagging

  • Twitter API for real-time updates and customer engagement

  • Pinterest API for product discovery and sharing

  • Google Maps API for location-based services

  • PayPal API for secure payment processing

View 1 answer

Q29. what is dsa and what is advantages

Ans.

DSA stands for Data Structures and Algorithms. It is essential for efficient problem-solving in software development.

  • DSA helps in organizing and managing data effectively

  • It improves the efficiency and performance of algorithms

  • Common data structures include arrays, linked lists, trees, graphs

  • Common algorithms include sorting, searching, and dynamic programming

Add your answer

Q30. what is cpp and its use case

Ans.

C++ is a programming language used for developing software applications.

  • C++ is a high-level programming language known for its performance and flexibility.

  • It is commonly used for developing system software, game engines, and applications that require high performance.

  • C++ supports object-oriented programming, generic programming, and low-level memory manipulation.

  • Examples of software developed using C++ include operating systems like Windows, game engines like Unreal Engine, a...read more

Add your answer

Q31. what is java and its use case

Ans.

Java is a popular programming language used for developing a wide range of applications.

  • Java is platform-independent, meaning it can run on any device with a Java Virtual Machine (JVM)

  • It is used for developing web applications, mobile apps, desktop applications, and enterprise software

  • Java is known for its security features and scalability

  • Examples of Java-based applications include Android apps, online banking systems, and e-commerce websites

Add your answer

Q32. Sort an array without inbuilt methods

Ans.

Sorting an array of strings without using inbuilt methods

  • Use a sorting algorithm like bubble sort, selection sort, or insertion sort

  • Compare each element with the next one and swap if necessary

  • Repeat the process until the array is sorted

Add your answer

Q33. What is the javascript

Ans.

JavaScript is a programming language used for creating interactive web pages and web applications.

  • JavaScript is a high-level, interpreted language.

  • It is primarily used for client-side scripting.

  • JavaScript can be embedded directly into HTML pages.

  • It provides dynamic functionality and interactivity to websites.

  • Common uses include form validation, DOM manipulation, and AJAX requests.

View 1 answer

Q34. what is linked list

Ans.

A linked list is a linear data structure where elements are stored in nodes that have a reference to the next node in the sequence.

  • Consists of nodes connected by pointers

  • Does not have a fixed size like arrays

  • Allows for efficient insertion and deletion operations

  • Example: Singly linked list, Doubly linked list

Add your answer

More about working at Google

Top Rated Large Company - 2024
Top Rated Internet/Product Company - 2024
HQ - Mountain View,California, United States
Contribute & help others!
Write a review
Share interview
Contribute salary
Add office photos

Interview Process at Ananya Technologies

based on 10 interviews
2 Interview rounds
Coding Test Round - 1
Coding Test Round - 2
View more
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Top Software Developer Interview Questions from Similar Companies

3.9
 • 67 Interview Questions
3.9
 • 38 Interview Questions
3.1
 • 19 Interview Questions
3.9
 • 17 Interview Questions
4.3
 • 15 Interview Questions
3.8
 • 13 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
75 Lakh+

Reviews

5 Lakh+

Interviews

4 Crore+

Salaries

1 Cr+

Users/Month

Contribute to help millions

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