# PayTM Interview Experience (1 Year Experienced)

• Difficulty Level : Hard
• Last Updated : 14 Sep, 2018

I was interviewed for Java Backend Developer profile at PayTM, Noida.

Round 1: Online Test

• There are n number of stones. Each stone has a weight associated with it. 1st stone’s weight is 1, 2nd stone’s weight is 2.. and so on. You are given an integer x. You need to pick the maximum number of stones such that the total weight of stones picked is less than x.
You’re also given an array of stones which you can not pick.
– Input:
n = 10 (there are 10 stones with weights 1, 2, 3, 4, 5, 6, 7, 8, 9 and 10)
x = 12 (total weight of collected stones can not exceed 12)
arr = {1, 2, 5} (stones with weight 1, 2 and 5 can not be picked)
– Output:
2 (Only 2 stones can be picked. {3, 4} or {3, 6} or {4, 6})
• Find the depth of JSON object.
– Input:
{x:[{a: 1, b: 2}, {a: 4, b: 5}], y: 1}
– Output:
3
Similar to: https://www.geeksforgeeks.org/find-maximum-depth-nested-parenthesis-string/

Round 2: Technical Interview

• Find number of ways to add up to a sum N using first N natural numbers.
– Example:
For n=3, Output=4 ([1+1+1], [1+2], [2+1], [3])
For n=4, Output=8 ([1+1+1+1], [1+1+2], [1+2+1], [1+3], [2+1+1], [2+2], [3+1], [4])
• Check if a binary tree is Binary search tree or not
• Find path from root to a given node in binary tree
I was asked 2 approaches: One using extra space and other without using extra space
• Implement queue using stacks
• N Queen problem
• Reverse a linked list in groups of given size
• Questions on Java:
• Difference between String, StringBuilder and StringBuffer
• Create a custom Immutable class
• Difference between wait() and sleep()
• What are different types of cloning in java and how do they work
• What is serialization? Suppose there is a class with fields int and String. We serialize an object of this class. Now can we deserialize this to an object of another class with fields as long and String?
• What are abstract classes?
• Resume based questions:
• What is REST API?
• How can we make a REST API stateless?
• How to secure a REST API?
• What is AJAX and why is it used?

Round 3: Technical Interview

• An in-depth discussion on the current project in the current organisation
• Design a system to handle 1 billion server hits in a day
• Find excel column name corresponding to a given column number
• Sort an array of 0s and 1s
• The cost of a stock on each day is given in an array, find the max profit that you can make by buying and selling in those days. You can only buy and sell the share once. For example, if the given array is {100, 180, 260, 310, 40, 535, 695}, the maximum profit can be earned by buying on day 4, selling on day 6.
• What is thread pool in java?
• What is an ORM?
• Difference between NoSQL and SQL. When do we prefer NoSQL over SQL?
• What are ACID properties?
• Difference between HTTP and HTTPS. How do they work?
• What are digital signatures?

Round 4: Technical Interview

• Difference between Spring and Springboot
• Given an array of 0, 1 and 2. Find the length of the shortest interval containing all three numbers.
– Input:
{1, 2, 2, 2, 1, 2, 1, 1, 0, 0, 1, 1, 2, 2}
– Output:
4 (interval from index 5 to 8)
• Design a parking lot

Round 5: HR Interview

• Introduce yourself
• Why do you want to change?
My Personal Notes arrow_drop_up