PayPal
100+ Interview Questions and Answers
You are given ‘N’ fences. Your task is to find the total number of ways to paint fences using 2 colors only such that at most 2 adjacent fences are painted with the same color.
As the answer can ...read more
You have given a Singly Linked List of integers, determine if it forms a cycle or not.
A cycle occurs when a node's next points back to a previous node in the list. The li...read more
Given an integer ‘N’, the task is to find its corresponding Roman numeral.
Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M.
Symbol Value I 1 V 5 X 10 L ...read more
Given a singly linked list of integers. Your task is to return the head of the reversed linked list.
For example:
The given linked list is 1 -> 2 -> 3 -> 4-> NULL. Then the reverse linked lis...read more
You have been given an undirected graph with 'N' vertices and 'M' edges. The vertices are labelled from 1 to 'N'.
Your task is to find if the graph contains a cycle or not.
A ...read more
You are given a string ‘st’, Your task is to find the length of the longest repeating subsequence such that two subsequences don’t have the same character at the same position.
For ...read more
Given an array/list of length ‘N’, where the array/list represents the boards and each element of the given array/list represents the length of each board. Some ‘K’ numbers of painter...read more
You have been given an N*M matrix filled with integer numbers, find the maximum sum that can be obtained from a path starting from any cell in the first row to any cell in the last...read more
You are given a sorted array A consisting of N integers. Your task is to find the magic index in the given array.
Note :
A magic index in an array A[0 ... N - 1] is defined to be an index i such that...read more
Given a sequence of numbers ‘ARR’. Your task is to return a sorted sequence of ‘ARR’ in non-descending order with help of the merge sort algorithm.
Example :
Merge Sort Algorithm - Merge sort is a Div...read more
Given a string ‘str’. Find the minimum number of partitions to make in the string such that every partition of the string is a palindrome.
Given a string, make cuts in that string to m...read more
You are given two arrays ‘arr’ of size ‘n’ and ‘queries’ of size ‘q’. For each element ‘q’ in the array 'queries', your task is to find the sum of all elements in the array ‘arr’ which are le...read more
You are given an integer ‘N’, which denotes there are ‘N’ friends. You are supposed to form some pairs them satisfying the following conditions:
1. Each friend can be paired with some oth...read more
Given a directed graph, check whether the graph contains a cycle or not. Your function should return true if the given graph contains at least one cycle, else return false.
Input...read more
Design a data structure that stores a mapping of a key to a given value and supports the following operations in constant time.
1. INSERT(key, value): Inserts an integer value to the data...read more
You are given a string ‘STR’. You need to find and return the minimum number of characters to be deleted from ‘STR’ so that the frequency of each character in the string becomes unique...read more
You have been given a number of stairs. Initially, you are at the 0th stair, and you need to reach the Nth stair. Each time you can either climb one step or two steps. You are...read more
You are given an unsorted array containing ‘N’ integers. You need to find ‘K’ largest elements from the given array. Also, you need to return the elements in non-decreasing order.
Input Format:...read more
You are given a string 'STR'. The string contains [a-z] [A-Z] [0-9] [special characters]. You have to find the reverse of the string.
For example:
If the given string is: STR = "abcde". You h...read more
You are given two arbitrary rectangles on a 2-D coordinate plane, which may have an intersecting area. You have to find the net area covered by both the rectangles on the car...read more
You are given an array 'ARR' of the 'N' element. Your task is to find the maximum difference between any of the two elements from 'ARR'.
If the maximum difference is even print “EVEN” without ...read more
You are given a Singly Linked List of integers which is sorted based on absolute value.
You have to sort the Linked List based on actual values.
The absolute value of a real number x, denoted |x...read more
You are given a string “S”. Your task is to rearrange the characters of a string “S”, such that it does not contain any two adjacent characters which are the same.
If it is possible to rearrange...read more
Given an undirected and disconnected graph G(V, E), containing 'V' vertices and 'E' edges, the information about edges is given using 'GRAPH' matrix, where i-th edge is between GRAPH[i][0] and GRAP...read more
You are given two strings, string A and string B. Your task is to determine whether string A can be transformed into string B by performing only one of the following operations at most one (or maybe zer...read more
You are given a Singly Linked List of integers. You need to reverse the Linked List by changing the links between nodes.
Input Format :
The first line of input contains a single integer T, re...read more
You are given an array/list ‘ARR’ of ‘N’ positive integers and an integer ‘K’. Your task is to check if there exists a subset in ‘ARR’ with a sum equal to ‘K’.
Note: Return true if there ex...read more
Given a binary tree with ‘root’. Your task is to find the sum of all the left leaf nodes.
Properties of leaf:-
In a binary tree, a leaf is a node such that it does not have any ch...read more
You are given two sorted arrays 'A' & 'B' of sizes 'N' & 'M'. You need to find the median of the two arrays when merged. If the total number of elements i.e., N + M is even then the m...read more
You have been given a linked list of integers. Your task is to write a function that deletes a node from a given position, 'POS'.
Note :
Assume that the Indexing for the linked lis...read more
You have been given an array/list ARR consisting of ‘N’ elements. Each element in the array is either 0, 1 or 2.
Now, your task is to sort this array/list in increasing order. For ...read more
You are given a sorted array 'A' of length 'N', two integers 'K' and 'X'. Your task is to print 'K' integers closest to 'X', if two integers are at the same distance return the smaller on...read more
You are given an integer 'N'. For a given 'N' x 'N' chessboard, find a way to place 'N' queens such that no queen can attack any other queen on the chessboard.
A queen can be killed when it lies in the ...read more
You are given an array consisting of 'N' distinct positive integers and a number 'K'. Your task is to find the kth largest element in the array.
Example:
Consider the ar...read more
You are given an undirected and disconnected graph G(V, E) having V vertices numbered from 0 to V-1 and E edges. Your task is to print its BFS traversal starting from the 0th vertex.
BFS or Breadth-...read more
You have been given a matrix of ‘N’ rows and ‘M’ columns filled up with integers. Find the minimum sum that can be obtained from a path which from cell (x,y) and ends at the top left corner (1,...read more
Ninja is studying sorting algorithms. He has studied all comparison-based sorting algorithms and now decided to learn sorting algorithms that do not require comparisons.
He was learning counting so...read more
You are given an array arr of length N. You have to return a list of integers containing the NGE(next greater element) of each element of the given array. The NGE for an element X is the fir...read more
You are given a string, ‘S’. You need to reverse the string where characters that are not an alphabet stay in the same place, and the rest reverse their positions.
Eg: “a-bcd” becomes “d-cba...read more
Given a binary tree. Print the Left View of the Tree.
Example :
If the input tree is as depicted in the picture:
The Left View of the tree will be: 2 35 2
Input format :
Elements in t...read more
You're given string ‘STR’ consisting solely of “{“, “}”, “(“, “)”, “[“ and “]” . Determine whether the parentheses are balanced.
Input Format:
The first line contains an Integer 'T' which denot...read more
You are given an array of integers 'ARR' of length 'N' and an integer Target. Your task is to return all pairs of elements such that they add up to Target.
Note:
We cannot use the element at a given inde...read more
You are given a string (STR) of length N, consisting of only the lower case English alphabet.
Your task is to remove all the duplicate occurrences of characters in the string.
For E...read more
You have been given an array/list of strings 'STR_LIST'. You are supposed to return the strings as groups of anagrams such that strings belonging to a particular group are anagrams of one...read more
Given an integer ‘N’ representing the number of pairs of parentheses, Find all the possible combinations of balanced parentheses with the given number of pairs of parentheses.
Note :
Conditi...read more
Given an alphabetical string ‘S’. Determine whether it is palindrome or not. A palindrome is a string that is equal to itself upon reversing it.
For example:
‘S’ = racecar The reverse of ‘S’ is:...read more
You are given two integers ‘dividend’ and ‘divisor’. You are required is to divide the integers without using multiplication, division and modular operators. Your task is to return the quotie...read more
Write a program to count and print the total number of characters (lowercase english alphabets only), digits (0 to 9) and white spaces (single space, tab i.e. '\t' and newline i.e. '\n') entered...read more
You have been given a string 'STR' of words. You need to replace all the spaces between words with “@40”.
Input Format:
The first line contains a single integer ‘T’ representing the number of test...read more
Q50. Input a file. Select first 3 lines of the file. Select the longest line and count the number of words in that line. It was easy. I used Java methods to solve the problem. I explained the logic and he accepted i...
read moreThe program reads a file and selects the first 3 lines. It then identifies the longest line and counts the number of words in that line.
Read the file using appropriate file handling methods
Store the first 3 lines in an array of strings
Iterate through the array to find the longest line
Count the number of words in the longest line using string manipulation methods
The Ultimate Ninja Ankush is a straightforward, no-nonsense guy and loves binary Trees, and he has given you a binary tree, and you have to return the vertical order traversal of the val...read more
Q52. But amazon can do the search in O(n). Why it has to go for O(nk)? For data structures like Hash tables and for large data, n will be large. So O(nk) is better than O(n) (former n is smaller than latter n).
O(nk) is better than O(n) for large data and hash tables.
O(nk) is better because it takes into account the size of the data and the number of keys.
For large data and hash tables, the size of n will be large, making O(nk) more efficient.
O(n) assumes a constant number of keys, which may not be the case in practice.
Amazon may have chosen O(nk) for better scalability and performance.
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 no...read more
Q54. When you search for a particular product in amazon, it displays some of the search results. But, only few particular products which are available in amazon are displayed, not all. How does this happen? I told M...
read moreAmazon displays only a subset of search results based on various factors like relevance, popularity, and user preferences.
Amazon uses algorithms to determine which products to display in search results.
Factors considered include product relevance, customer reviews, sales rank, and availability.
Machine learning techniques may be used to personalize search results based on user behavior and preferences.
Amazon also considers factors like seller reputation and fulfillment options...read more
Q55. There exists a 3x3 matrix, start from the first element reach the last element of the matrix, between each edges there exists a weight. Reach the destination such that the sum of weights should be small. It was...
read moreThe question is about finding the shortest path in a 3x3 matrix with weighted edges.
This is a graph traversal problem.
Use a graph algorithm like Dijkstra's algorithm or A* search to find the shortest path.
Assign weights to the edges and calculate the sum of weights for each possible path.
Choose the path with the smallest sum of weights as the shortest path.
When you search for a particular product in amazon, it displays some of the search results. But, only few particular products which are available in amazon are displayed, not all. How does thi...read more
What is hashing and how can it be implemented?
He showed a puzzle where n-balloons were there and I had to burst maximum balloons using an arrow.
Two strings ‘S1’ and ‘S2’ are considered similar if either ‘S1’ equals ‘S2’ or we can swap two letters of ‘S1’ (at different positions) so that it equals ‘S2’.
For Example :
“code” and “eod...read more
Q60. How would I explain the concept of prime number to an illiterate?
A prime number is a number that is divisible only by 1 and itself.
A prime number has exactly two factors: 1 and itself.
Prime numbers cannot be divided evenly by any other number.
Examples of prime numbers include 2, 3, 5, 7, 11, 13, 17, etc.
Asked me about some advanced DBMS concepts like windowing, triggers, joins, and indexing.
Q62. What js E cheque ? And what is the time for its clearance
An e-cheque is an electronic version of a paper cheque that is used for making payments online.
E-cheques are created and signed digitally, eliminating the need for physical paper.
They are typically used for online transactions and can be deposited into a bank account electronically.
The clearance time for e-cheques varies depending on the bank and the specific transaction.
It can take anywhere from a few hours to several business days for an e-cheque to clear.
During the clearan...read more
The questions will be based on low level system design and you will be given certain conditions for which you have to design a system.
This round is behavioral and cultural based round and manager wants to know how can i handle the critical situation.
He asked me how I will check whether I have internet connection in my system?
Q66. What will be the key and what will be the values? The product will be the key. The brands will be the values.
The product will be the key and the brands will be the values.
The key in this case refers to the unique identifier for each product.
The values are the different brands associated with each product.
For example, if the product is a smartphone, the key could be the model number and the values could be the different brands that manufacture that model.
Q67. Five advantages of spring boot Which java version you currently use? Features of the java version you use Output from the code Difference between this and super In order to update the string, which will be bett...
read moreSpring Boot offers advantages like rapid development, easy configuration, embedded servers, production-ready features, and more.
Rapid development: Spring Boot simplifies the setup and configuration of Spring applications, allowing developers to focus on writing business logic.
Easy configuration: Spring Boot provides auto-configuration, reducing the need for manual setup and boilerplate code.
Embedded servers: Spring Boot comes with embedded servers like Tomcat, Jetty, and Unde...read more
Questions on optimisations of a particular use case and scenario.
How can we reduce the number of API calls?
Behavioural questions on leadership aspirations etc.
1. Merchant Onboarding Design
2. Restaurant Design
What are your strengths and weaknesses?
Why do you want to join us?
What is JIT compiler?
Scheduling algos.
2nd highest salary using joins of tables
In how many attempts can one find a defective ball among 10 given balls after weighting it in a 2 weight weighting pan?
There are three boxes, one box of blue balls, one green and one mixed ,all labelled incorrectly. In how many trials will I label them correctly ?
Q74. Suggest as many methods as possible for finding the nth largest element in an unsorted linked list
Methods to find nth largest element in an unsorted linked list
Traverse the linked list and store elements in an array, sort the array and return the nth largest element
Use quickselect algorithm to find the nth largest element in O(n) time complexity
Implement a max heap and extract the nth largest element
Divide the linked list into smaller sublists and recursively find the nth largest element
Use merge sort to sort the linked list and return the nth largest element
Q75. Do you know Radix Sort? Where it is used? Radix sort can be applied in amazon.
Radix sort is a sorting algorithm that sorts integers by processing individual digits from least significant to most significant.
Radix sort is a non-comparative sorting algorithm.
It sorts numbers by grouping them based on each digit's value.
It is commonly used for sorting strings in lexicographic order.
Radix sort has linear time complexity, making it efficient for large datasets.
What happens when you type a URL in the web browser?
Q77. what is hashing and how will you implement?
Hashing is a process of converting data into a fixed-size numerical value called a hash code.
Hashing is used to quickly retrieve data from large datasets.
It is commonly used in data structures like hash tables and hash maps.
Hash functions should be fast, deterministic, and produce unique hash codes for different inputs.
Examples of hash functions include MD5, SHA-1, and SHA-256.
OOPS contains 3 classes A,B,C and they are in multi level inheritance, was asked about the use of public, protected and private members of A in B and in C
Design a Rate Limiter.
Q80. What data structure do they use? Hash tables.
Hash tables are a data structure that uses a hash function to map keys to values, providing efficient lookup, insertion, and deletion.
Hash tables use a hash function to convert keys into array indices.
They provide constant-time average case complexity for search, insert, and delete operations.
Collisions can occur when different keys map to the same index, which can be resolved using techniques like chaining or open addressing.
Examples of hash table implementations include Pyt...read more
Q81. Explain the concepts of Object Oriented Programming
Object Oriented Programming is a programming paradigm that uses objects to represent real-world entities.
Encapsulation: bundling data and methods that operate on that data within one unit
Inheritance: creating new classes from existing ones, inheriting their properties and methods
Polymorphism: ability of objects to take on multiple forms or behaviors
Abstraction: hiding complex implementation details and providing a simplified interface
Example: A car object can have properties ...read more
Q82. Design classes for educational institutions in a city
Design classes for educational institutions in a city
Identify the main entities: schools, students, teachers, courses
Create a School class with attributes like name, address, and a list of students and teachers
Create a Student class with attributes like name, age, and a list of courses
Create a Teacher class with attributes like name, specialization, and a list of courses
Create a Course class with attributes like name, duration, and a list of students and teachers
Establish rel...read more
Q83. Application of Fibonacci series in day-to-day life.
The Fibonacci series can be applied in day-to-day life for various purposes.
Financial planning: Fibonacci numbers can be used to calculate investment growth and determine optimal investment strategies.
Architecture and design: Fibonacci ratios can be used to create aesthetically pleasing designs and layouts.
Nature and biology: Fibonacci patterns can be observed in the growth of plants, arrangement of leaves, and formation of shells.
Music and art: Fibonacci sequences can be use...read more
Q84. no of pairs between 1 and N satisfy relation pow(a,3)+pow(b,3)=pow(c,3)+pow(d,3).a,b,c,d<=N
The question asks for the number of pairs between 1 and N that satisfy a specific mathematical relation.
The relation is pow(a,3) + pow(b,3) = pow(c,3) + pow(d,3)
The values of a, b, c, and d should be less than or equal to N
Count the number of pairs that satisfy the relation
Q85. find the and return if the given file path existing in the given file hierarcy(file system).
Check if a given file path exists in the file system hierarchy and return the result.
Use file system APIs to check if the given file path exists in the hierarchy.
Traverse the file system hierarchy starting from the root directory to find the given file path.
Return true if the file path exists, false otherwise.
Q86. Show the abstraction and write code for function overriding
Abstraction is hiding the implementation details, function overriding is providing a new implementation for a method in a subclass.
Abstraction involves hiding the complex implementation details and showing only the necessary features to the user.
Function overriding occurs in inheritance when a subclass provides a specific implementation for a method that is already defined in its superclass.
Example: Parent class 'Animal' has a method 'makeSound()', subclass 'Dog' overrides th...read more
Q87. Give a few test cases for a bank transaction
Test cases for a bank transaction
Transaction amount within account balance limit
Transaction amount exceeds account balance limit
Transaction to a valid account number
Transaction to an invalid account number
Transaction with correct transaction code
Transaction with incorrect transaction code
Transaction during bank working hours
Transaction outside bank working hours
Q88. Given an array of numbers find the subset of numbers that give zero sum.
Find subset of numbers in array that sum up to zero.
Use a nested loop to iterate through all possible subsets.
Calculate the sum of each subset and check if it equals zero.
Store the subset if the sum is zero.
Optimize the solution by using a hash set to store the cumulative sum of elements.
Applications of Fibonacci series in real life
Q90. Optimal path cost and path in a matrix . Dynamic programming
Finding optimal path cost and path in a matrix using dynamic programming.
Dynamic programming is a technique to solve problems by breaking them down into smaller subproblems and solving them recursively.
In this case, we can use dynamic programming to find the optimal path cost and path in a matrix.
We can start by defining a 2D array to store the minimum cost of reaching each cell in the matrix.
Then, we can use a recursive function to calculate the minimum cost of reaching the ...read more
// level: basic// tags: closures// implement a sum functionsum(4)(5) // 9// expected output const sum = x => y => x + y ,Debouncing.
Q1. Firstly was asked about the subjects I'm studying this semester
Q2. Different questions about my projects
Q93. What you do if the customer is not happy for genivan cause?
Listen to their concerns, apologize, offer a solution, and follow up to ensure satisfaction.
Listen actively to their concerns and empathize with their situation.
Apologize for any inconvenience caused and take responsibility for the issue.
Offer a solution that addresses their concerns and meets their needs.
Follow up with the customer to ensure their satisfaction and address any further concerns.
Document the issue and the steps taken to resolve it for future reference.
Q94. Common puzzle- There are three boxes,one box of blue balls, one green and one mixed ,all labelled incorrectly. In how many trials will i label them correctly...
read moreQ95. Program to implement Dijkstra’s algorithm
Dijkstra's algorithm finds the shortest path between nodes in a graph.
Create a graph with nodes and edges
Assign a tentative distance to each node
Set the initial node as current and mark it visited
For each neighbor of the current node, calculate the tentative distance
If the tentative distance is less than the current distance, update the distance
Mark the current node as visited and select the unvisited node with the smallest tentative distance
Repeat until the destination node ...read more
Q96. There are 10 weights of which two weigh less than the others. Using a balance how will i identify the defective ones...
read moreQ97. How many A4 sheets are sold in India per day?
It is impossible to accurately determine the number of A4 sheets sold in India per day.
There is no centralized data on the sales of A4 sheets in India.
The number of A4 sheets sold can vary greatly depending on the region and industry.
Factors such as digitalization and environmental concerns may also impact sales.
Estimates or projections may be available from specific companies or industries.
Market research firms may have data on the overall paper market in India.
Q98. A recursive program to print numbers in ascending order
Q99. Program to reverse a singly linked list
A program to reverse a singly linked list
Create a new empty linked list
Traverse the original linked list and insert each node at the beginning of the new list
Return the new list
Q100. Give examples of abstraction and polymorphism
Abstraction is hiding implementation details while polymorphism is using a single interface for multiple types.
Abstraction: Encapsulation, Interfaces, Abstract classes
Polymorphism: Method Overloading, Method Overriding, Interfaces
Abstraction Example: Car - we don't need to know how the engine works to drive it
Polymorphism Example: Animal - different animals have different sounds but they all have a 'makeSound' method
Top HR Questions asked in null
Interview Process at null
Top Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month