Add office photos
Employer?
Claim Account for FREE

Directi

4.0
based on 58 Reviews
Filter interviews by

70+ Paras Spices Interview Questions and Answers

Updated 5 Feb 2024
Popular Designations

Q1. 2)Given an n x n matrix, where every row and column is sorted in increasing order. Given a number x, how to decide whether this x is in the matrix. The designed algorithm should have linear time complexity. a) ...

read more
Ans.

Algorithm to find if a number is present in a sorted n x n matrix with linear time complexity.

  • Start with the top right element

  • Compare the element with x

  • If equal, return its position

  • If e < x, move down (if out of bounds, return false)

  • If e > x, move left (if out of bounds, return false)

  • Repeat till element is found or returned false

Add your answer

Q2. 4)Given a set of integers, Display the non-empty subsets whose sum is zero. For example, given the set { −7, −3, −2, 5, 8}, the answer is the subset { −3, −2, 5} which sums to zero. This is the special case of ...

read more
Ans.

The problem is to find non-empty subsets of a given set of integers whose sum is zero.

  • The problem is a special case of the knapsack problem and is known to be NP-Complete.

  • A brute-force approach would involve generating all subsets and checking their sums.

  • The brute-force approach has an exponential time complexity.

  • There is no known polynomial time solution for this problem.

Add your answer

Q3. Sub Divide a Rectangle. Given a Rectangle of M X N. U have many smaller rectangles of M1 X N1 and so on. You have to divide the greater rectangle in such a way to minimize the wastage. Rules of division are, ev...

read more
Ans.

Divide a rectangle of M x N into smaller rectangles of M1 x N1 to minimize wastage.

  • Start by dividing the rectangle horizontally or vertically based on the dimensions of the smaller rectangles.

  • Continue dividing each resulting sub-rectangle until no further division is possible.

  • Consider the dimensions of the smaller rectangles and the remaining space to minimize wastage.

  • Keep track of the divisions made to reconstruct the original rectangle if needed.

Add your answer

Q4. Suppose there are ‘n’ trees (literal trees, not trees of computer science, suppose they don’t have any branch, more like a straight stick), each of them have some height. We want x length of wood. We have a woo...

read more
Add your answer
Discover Paras Spices interview dos and don'ts from real experiences
Q5. Maximum Product Subarray

You are given an array “arr'' of integers. Your task is to find the contiguous subarray within the array which has the largest product of its elements. You have to report this maximum pr...read more

View 3 more answers

Q6. Beer overflow problem. Glasses are stacked like a pyramid onto a table. If you are given X liters of water to pour on the topmost glass, How much water will be held by each glass. Given, Xth glass an hold x lit...

read more
Ans.

The glasses are stacked like a pyramid on a table. Each glass can hold a certain amount of water, and the overflow is distributed equally to the glasses below.

  • The glasses form a pyramid shape, with the topmost glass being the first level and each subsequent level having one more glass than the previous level.

  • The amount of water held by each glass can be calculated by dividing the total amount of water by the number of glasses in that level.

  • For example, if there are 10 glasses...read more

Add your answer
Are these interview questions helpful?
Q7. Find duplicate in array

You are given an array/list 'ARR' consisting of N integers, which contains elements only in the range 0 to N - 1. Some of the elements may be repeated in 'ARR'. Your task is to find all s...read more

View 3 more answers
Q8. Maximum Sum Subarray

Given an array of numbers, find the maximum sum of any contiguous subarray of the array.

For example, given the array [34, -50, 42, 14, -5, 86], the maximum sum would be 137, since we would ...read more

View 4 more answers
Share interview questions and help millions of jobseekers 🌟

Q9. 5)Create a data structure where inserting, deleting and finding the minimum element all have O(1) time. i said we can use augmented stack where with each element we can augment the minimum element along with it...

read more
Ans.

Data structure with O(1) insert, delete, and find min without creating new structures

  • Use two stacks, one for actual data and one for minimum values

  • When inserting, push the value onto the data stack and push the minimum of the new value and the top of the minimum stack onto the minimum stack

  • When deleting, pop from both stacks

  • When finding the minimum, return the top of the minimum stack

Add your answer
Q10. Exclusive time of functions.

This time we are executing a program containing ‘N’ functions on a single-threaded CPU. Each function has a unique ‘ID’ between 0 and (N-1) and each time it starts or ends, we write ...read more

View 2 more answers
Q11. Dijikstra Algorithm

You have been given an undirected graph of ‘V’ vertices (labeled 0,1,..., V-1) and ‘E’ edges. Each edge connecting two nodes (‘X’,’Y’) will have a weight denoting the distance between node ‘X...read more

View 3 more answers
Q12. Sibling Nodes

You have been given a Binary Tree of ‘N’ nodes, where the nodes have integer values. Your task is to print all nodes that don’t have a sibling node.

Note:
1. Node ‘U’ is said to be a sibling of nod...read more
View 2 more answers
Q13. Occurrence of X in a Sorted Array.

You have been given a sorted array/list of integers of size N and an integer X. Find the total number of occurrences of X in the array/list.

Input Format
The first line of the ...read more
View 3 more answers
Q14. Print leaf nodes

Given a binary tree, write a function that returns a list containing all the leaf nodes of the binary tree in the order in which they appear from left to right. In case two leaf nodes are at the...read more

Add your answer
Q15. Find a triplet that sum to a given value

You are given an array/list ARR consisting of N integers. Your task is to find all the distinct triplets present in the array which adds up to a given number K.

An array ...read more

View 3 more answers
Q16. Stock Buy and sell

You are given an array/list 'prices' where the elements of the array represent the prices of the stock as they were yesterday and indices of the array represent minutes. Your task is to find a...read more

View 3 more answers
Q17. Merge overlapping intervals

Given 'N' number of intervals, where each interval contains two integers denoting the boundaries of the interval. The task is to merge all the overlapping intervals and return the lis...read more

View 2 more answers

Q18. Algorithms: Write an algorithm to list elements of a Fibonacci series; There are two unsorted arrays (with no repeating elements) – find the median of the combined array (use a 3rd array if you wish). Find the ...

read more
Ans.

Algorithm to list Fibonacci series and find median of combined array with and without 3rd array

  • For Fibonacci series, start with 0 and 1, then add previous two numbers to get next number

  • For finding median of combined array, merge the two arrays and sort them, then find the middle element(s)

  • For finding median without 3rd array, use two pointers to traverse both arrays simultaneously and keep track of previous and current elements

Add your answer

Q19. Design a car sharing app. Create mockups, describe features. What is your customer acquisition strategy?

Ans.

A car sharing app that connects car owners with people who need a ride.

  • Users can search for available cars in their area and book a ride.

  • Car owners can list their car and set their own price for the ride.

  • The app should have a rating system for both drivers and passengers.

  • Payment should be handled through the app.

  • Customer acquisition strategy can include social media advertising, referral programs, and partnerships with local businesses.

Add your answer
Q20. Box Stacking

You are given a set of ‘n’ types of rectangular 3-D boxes. The height, width, and length of each type of box are given by arrays, ‘height’, ‘width’, and ‘length’ respectively, each consisting of ‘n’...read more

View 3 more answers

Q21. Recommendation engine: What factors will you consider while designing a recommendation engine for a news website like MSN?

Ans.

Factors to consider while designing a recommendation engine for a news website like MSN.

  • Identify user preferences and behavior

  • Analyze user history and engagement

  • Consider content relevance and recency

  • Incorporate social media trends and user feedback

  • Use collaborative filtering and machine learning algorithms

  • Ensure diversity in recommendations

  • Optimize for speed and scalability

Add your answer
Q22. Evaluation of postfix expression

An expression is called the postfix expression if the operator appears in the expression after the operands.

Example :

Infix expression: A + B * C - D Postfix expression: A B + C...read more
Add your answer

Q23. You start with A. In every step, A gets transformed to AB and B get transformed to BA. You are supposed to tell how many ‘BB’ will occur at Nth iteration. E.G. A AB ABBA ABBABAAB … So on

Ans.

The number of 'BB' occurrences at the Nth iteration of the transformation sequence.

  • At each iteration, A gets transformed to AB and B gets transformed to BA.

  • To find the number of 'BB' occurrences at the Nth iteration, we need to count the number of 'BB' substrings in the transformed string.

  • The transformation sequence follows a pattern: AB, ABA, ABAAB, ABAABABA, ...

  • The number of 'BB' occurrences doubles with each iteration: 0, 0, 1, 2, 4, 8, 16, ...

  • To calculate the number of 'B...read more

Add your answer

Q24. 1)There are three types of balls arranged linearly in a random order Red, Green and Blue. Now your job is to sort them so that the Red balls are in front follwed by the Green balls and the Blue balls are pushed...

read more
Ans.

Sorting an array of 0, 1 and 2 can be done in O(n) using two pointers.

  • Use two pointers, one for 0 and one for 2, and a current pointer to traverse the array

  • If the current pointer encounters a 0, swap it with the 0 pointer and move both pointers to the right

  • If the current pointer encounters a 2, swap it with the 2 pointer and move the 2 pointer to the left

  • Repeat until the current pointer meets the 2 pointer

Add your answer

Q25. How much should BookMyShow bid for an AdWord that will figure as the top result in a Google search?

Ans.

The bid for the AdWord should be based on the value of a click and the conversion rate.

  • Calculate the value of a click by estimating the revenue generated per click.

  • Determine the conversion rate of the website to estimate the number of clicks needed to generate a sale.

  • Consider the competition for the keyword and adjust the bid accordingly.

  • Use tools like Google Keyword Planner to estimate the bid range for the keyword.

  • Regularly monitor and adjust the bid based on performance.

  • Ex...read more

Add your answer

Q26. Ad fraud: How is ad fraud carried out? How will you detect a bot’s fraud (list all mechanisms).

Ans.

Ad fraud and detecting bot fraud mechanisms

  • Ad fraud can be carried out through click fraud, impression fraud, and conversion fraud

  • Detecting bot fraud can be done through analyzing user behavior, IP addresses, and device information

  • Other mechanisms include using machine learning algorithms and third-party verification tools

  • Examples of bot fraud detection tools include WhiteOps, DoubleVerify, and Integral Ad Science

View 1 answer

Q27. You have an undirected weighted graph, given input ‘x’ and ‘y’, which are any two vertices of the graph, you have to output all the edges that are in any of the shortest path from x to y. Note that there can be...

read more
Ans.

Output all edges in any shortest path from x to y in an undirected weighted graph

  • Use Dijkstra's algorithm to find all shortest paths from x to y

  • Store the predecessor of each vertex to reconstruct the paths

  • Output all edges in any of the shortest paths found

Add your answer

Q28. Give a brief of the features suggested in the case solution submitted.

Ans.

The case solution submitted suggested features such as personalized recommendations, social media integration, and a user-friendly interface.

  • Personalized recommendations based on user behavior and preferences

  • Social media integration for easy sharing and promotion

  • User-friendly interface with intuitive navigation and clear calls to action

  • Integration with third-party services such as payment gateways and shipping providers

  • Robust analytics and reporting tools for tracking perform...read more

Add your answer

Q29. Suppose there are two piles of plates in the table. One has ‘m’ RED plates and other has ‘n’ BLACK plates. In his/her chance, a player can either pick any number of red plates or any number black plates or equa...

read more
Add your answer

Q30. Suppose you are given a string of length n and a set of pairs(i, j such that 0 &lt;= i &lt; j &lt; n). Pair “i, j” (0 based indexing) means that you can swap the i’th and j’th character in the string any number of times...

read more
Ans.

Given a string and pairs of indices, output the lexicographically smallest string after swapping characters.

  • Sort the pairs based on the first index in ascending order.

  • Use union-find data structure to keep track of connected components.

  • Swap characters in the string based on the connected components.

  • Return the lexicographically smallest string.

Add your answer

Q31. Pick the feature that is a revenue stream and estimate the revenue generated in a year.

Ans.

The subscription feature is a revenue stream.

  • Subscription feature allows users to pay for premium content or services.

  • Estimate revenue based on current user base and potential growth.

  • Consider pricing strategy and competition.

  • Example: Spotify Premium generates $1.5 billion in revenue annually.

Add your answer
Q32. Implement Facebook Tag Feature

I was asked to implement the Facebook tag features . For a given box, tag a location inside a box, and whenever your mouse hovers near it show the tag.

Add your answer

Q33. If we are given a matrix such that its rows and column are sorted search a number in o(n+m) complexity....

Ans.

Use binary search starting from top right corner to find the number in O(n+m) complexity.

  • Start from the top right corner of the matrix

  • If the current number is greater than the target, move left

  • If the current number is less than the target, move down

  • Repeat until the number is found or out of bounds

Add your answer

Q34. If we are give a link list such that a few nodes from end are common....and both are of unknown different length....how to find first common node....

Add your answer

Q35. int x=5; fun() {x++;} if 3 threads run this function and am reading x at last, what will be value of x?

Ans.

The value of x will depend on the execution order of the threads.

  • The function fun() increments the value of x by 1.

  • If all three threads run the function concurrently, the final value of x will be 8.

  • If the threads run sequentially, the final value of x will be 7.

Add your answer

Q36. Suppose we have a huge CSV file having ip-address ranges and its corresponding country code, given any ip-address how will we find the country which it belongs to

Ans.

To find the country of an IP address from a CSV file, we can use a lookup table based on the IP address range.

  • Create a lookup table from the CSV file with IP address ranges and corresponding country codes

  • Parse the given IP address and match it with the ranges in the lookup table to find the corresponding country code

  • Use binary search for efficient lookup in the IP address ranges

  • Handle cases where the given IP address falls outside the ranges in the lookup table

Add your answer

Q37. What do we use for IPC if processes run on different systems?

Add your answer

Q38. If we r given time in hh:mm find the angle between hr hand and minute hand.

Add your answer

Q39. why dont we store cookies details in server instead of storing in client system?

Ans.

Storing cookies on the client system allows for personalized user experiences and reduces server load.

  • Storing cookies on the client system allows for faster access to user data without the need to constantly query the server.

  • Cookies can store user preferences and login information, making the browsing experience more personalized.

  • Server-side storage of cookies would require more server resources and could slow down the website's performance.

  • Client-side storage also allows for...read more

Add your answer

Q40. i can run concurrent process. then why should i use threads?

Ans.

Threads allow for more efficient use of resources and better performance compared to running concurrent processes.

  • Threads are lighter weight than processes, requiring less overhead to create and manage.

  • Threads share the same memory space, allowing for easier communication and data sharing between threads.

  • Threads are more efficient for tasks that require frequent communication or synchronization.

  • Threads are commonly used in GUI applications to keep the user interface responsiv...read more

Add your answer

Q41. can we implement overloading using different return types of function and Why?

Ans.

No, we cannot implement overloading using different return types of function.

  • Overloading is based on the number and types of parameters, not the return type.

  • If we have two functions with the same name and parameters but different return types, it will result in a compilation error.

  • Return type alone is not sufficient to differentiate between overloaded functions.

Add your answer
Q42. System Design

Design a streaming service like Netflix and how does it onboard new content.

Add your answer

Q43. What are threads. Why do we use them ?

Add your answer

Q44. How to find nth node from end in a link list in only one scan

Add your answer

Q45. You have a huge linked list, how will you detect any loop in the linked list

Ans.

To detect a loop in a linked list, we can use Floyd's Cycle Detection Algorithm.

  • Use two pointers, one moving at twice the speed of the other

  • If there is a loop, the two pointers will eventually meet at some point

  • Alternatively, use a hash set to store visited nodes and check for duplicates

Add your answer

Q46. You are given a n*n matrix having 1's an 0's in them an given an integer k. You have to find a rectangular region such that it has k 1's in it

Ans.

Find a rectangular region in a binary matrix with k 1's.

  • Iterate over all possible rectangular regions and count the number of 1's in each.

  • Use a sliding window approach to efficiently count the number of 1's in each rectangular region.

  • Use dynamic programming to precompute the number of 1's in each sub-rectangle and answer queries in constant time.

Add your answer

Q47. What r all complex data structures you have implemented?

Add your answer

Q48. Formulate the angle between the hour hand and minute hand of the clock for any given time

Ans.

The angle between the hour hand and minute hand of a clock can be calculated using a simple formula.

  • The angle between the hour hand and minute hand is given by the formula: |(30H - 11/2) - 6M| degrees

  • H is the hour hand position and M is the minute hand position

  • If the result is greater than 180 degrees, subtract it from 360 degrees to get the acute angle

View 1 answer

Q49. what is overriding and why using it? again to networks

Ans.

Overriding is a concept in object-oriented programming where a subclass provides a specific implementation of a method that is already provided by its superclass.

  • Overriding allows a subclass to provide a specific implementation of a method that is already defined in its superclass.

  • It is used to achieve runtime polymorphism in object-oriented programming.

  • The method in the subclass must have the same name, return type, and parameters as the method in the superclass to override ...read more

Add your answer

Q50. write query to find 3rd highest mark of students in student table with name and marks? Then he asked my favourite language and replied “OOPS­C++”

Add your answer

Q51. what is index &amp; why we are using it in Database?

Add your answer

Q52. is parallelism possible in merge sort using threads?

Add your answer

Q53. what is HTTP and why it is used?

Add your answer

Q54. Find any duplicate number in an array of very big size

Ans.

Find any duplicate number in an array of very big size

  • Use a hash table to keep track of visited numbers

  • Iterate through the array and check if the number is already in the hash table

  • If it is, return the number as duplicate

Add your answer

Q55. In an array find maximum non consecutive sum sequence...

Add your answer

Q56. Given an array. Find indices i and j such that A[i]&gt;a[j] and i&gt;j such that ij is minimum

Ans.

Find indices i and j such that A[i]>a[j] and i>j such that ij is minimum

  • Iterate through the array and keep track of the minimum value and its index

  • Iterate through the array again and check if A[i]>min and i

  • If yes, update the minimum index to j

  • Return the minimum index

  • Time complexity: O(n)

Add your answer

Q57. what is purpose of virtual keyword?

Ans.

The virtual keyword is used in object-oriented programming to indicate that a method or property can be overridden in a derived class.

  • The virtual keyword allows for polymorphism, where a derived class can provide its own implementation of a method or property inherited from a base class.

  • It enables the concept of dynamic dispatch, where the appropriate method implementation is determined at runtime based on the actual type of the object.

  • The virtual keyword is typically used in...read more

Add your answer

Q58. How do we synchronize our programs?

Add your answer

Q59. What are deadlocks. Give some example.

Add your answer

Q60. what is cookies and why it is used?

Add your answer

Q61. what is inheritance and why using it?

Add your answer

Q62. what is polymorphism and why using it?

Add your answer

Q63. what is overloading and why using it?

Add your answer

Q64. Why do we prefer oops?

Add your answer

Q65. explain sliding window protocol?

Ans.

Sliding window protocol is a technique used in computer networks to ensure reliable and efficient data transmission.

  • Sliding window protocol is used to manage the flow of data between sender and receiver in a network.

  • It divides the data into small packets and assigns a sequence number to each packet.

  • The sender sends a fixed number of packets and waits for acknowledgment from the receiver before sending more packets.

  • If an acknowledgment is not received within a certain time, th...read more

Add your answer

Q66. significance of thread over process?

Ans.

Threads provide a lightweight way to achieve multitasking within a process.

  • Threads share the same memory space, while processes have separate memory spaces.

  • Threads are faster to create and terminate compared to processes.

  • Threads allow for efficient communication and synchronization between different parts of a program.

  • Threads are commonly used in applications that require concurrent execution, such as web servers or multimedia software.

  • Example: In a web server, multiple threa...read more

Add your answer

Q67. Finding majority element in an array

Ans.

Finding majority element in an array

  • Use a hash table to store the frequency of each element

  • Iterate through the hash table to find the element with frequency greater than n/2

  • If no such element exists, return -1

Add your answer

Q68. How was the ppt?

Add your answer

Q69. NonConsecutive Maximum Sum problem

Ans.

Find the maximum sum of non-consecutive elements in an array.

  • Create an array to store the maximum sum up to each index.

  • Iterate through the array and calculate the maximum sum at each index.

  • Return the maximum sum at the last index of the array.

  • Exclude consecutive elements by skipping the previous index in the sum calculation.

Add your answer

Q70. Difference between BST and tries

Add your answer

Q71. Any higher studies plan?

Add your answer

Q72. Maximum Sum SubArray Problem

Ans.

Maximum Sum SubArray Problem is to find the contiguous subarray within a one-dimensional array of numbers which has the largest sum.

  • The problem can be solved using Kadane's algorithm in O(n) time complexity.

  • Initialize two variables, max_so_far and max_ending_here, to 0.

  • Loop through the array and for each element, add it to max_ending_here.

  • If max_ending_here becomes negative, reset it to 0.

  • If max_so_far is less than max_ending_here, update max_so_far.

  • Return max_so_far as the m...read more

Add your answer
Contribute & help others!
Write a review
Share interview
Contribute salary
Add office photos
Top Directi Interview Questions And Answers
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