Add office photos
Paytm logo
Engaged Employer

Paytm

Verified
3.3
based on 7.4k Reviews
Video summary
Filter interviews by
Software Developer
Fresher
Experienced
Skills
Clear (1)

40+ Paytm Software Developer Interview Questions and Answers

Updated 8 Jan 2025

Q1. Reverse Linked List Problem Statement

Given a singly linked list of integers, return the head of the reversed linked list.

Example:

Initial linked list: 1 -> 2 -> 3 -> 4 -> NULL
Reversed linked list: 4 -> 3 -> 2...read more
Ans.

Reverse a singly linked list of integers and return the head of the reversed linked list.

  • Iterate through the linked list and reverse the pointers to point to the previous node instead of the next node.

  • Use three pointers to keep track of the current, previous, and next nodes while reversing the linked list.

  • Update the head of the reversed linked list as the last node encountered during the reversal process.

View 1 answer
right arrow

Q2. Rotting Oranges Problem Statement

You are given a grid containing oranges where each cell of the grid can contain one of the three integer values:

  • 0 - representing an empty cell
  • 1 - representing a fresh orange...read more
Ans.

Find the minimum time required to rot all fresh oranges in a grid.

  • Use Breadth First Search (BFS) to simulate the rotting process of oranges.

  • Track the time taken to rot all fresh oranges and return the result.

  • If any fresh oranges remain after simulation, return -1 as it is impossible to rot all oranges.

Add your answer
right arrow
Paytm Software Developer Interview Questions and Answers for Freshers
illustration image

Q3. Maximum Subarray Sum Problem Statement

Given an array of integers, determine the maximum possible sum of any contiguous subarray within the array.

Example:

Input:
array = [34, -50, 42, 14, -5, 86]
Output:
137
E...read more
Ans.

Find the maximum sum of any contiguous subarray within an array of integers.

  • Iterate through the array and keep track of the maximum sum of subarrays encountered so far.

  • At each index, decide whether to include the current element in the subarray or start a new subarray.

  • The maximum subarray sum can be calculated using Kadane's algorithm.

  • Example: For array [34, -50, 42, 14, -5, 86], the maximum sum is 137.

  • Example: For array [-5, -1, -8, -9], the maximum sum is -1.

Add your answer
right arrow

Q4. Delete a Node from Linked List Problem Statement

Given a linked list of integers, your task is to implement a function that deletes a node at a specified position, 'POS'.

If the specified position is greater th...read more

Ans.

Implement a function to delete a node at a specified position in a linked list.

  • Traverse the linked list to find the node at the specified position.

  • Update the pointers to skip the node to be deleted.

  • Handle edge cases like deleting the head or tail node.

  • Return the modified linked list.

Add your answer
right arrow
Discover Paytm interview dos and don'ts from real experiences

Q5. Delete a Node in a Linked List

Given a reference to a node in a singly linked list, your task is to delete that node. Every node in the list has a unique value. The head of the linked list will not be provided....read more

Ans.

To delete a node in a singly linked list given a reference to the node.

  • Traverse the linked list to find the node to be deleted.

  • Update the value of the node to be deleted with the value of the next node.

  • Point the next pointer of the node to be deleted to the next node's next pointer.

Add your answer
right arrow

Q6. Smallest Integer Not Representable as Subset Sum

Given a non-decreasing sorted array ARR of N positive numbers, determine the smallest positive integer that cannot be expressed as the sum of elements from any p...read more

Ans.

The task is to find the smallest positive integer value that cannot be represented as a sum of elements of any proper subset of the given array.

  • The array is sorted in non-decreasing order, so we can iterate through the array and keep track of the maximum sum we can form.

  • If the current element is greater than the maximum sum + 1, then the maximum sum + 1 is the smallest positive integer that cannot be represented.

  • If all elements in the array can be represented as a sum of subs...read more

Add your answer
right arrow
Are these interview questions helpful?

Q7. Minimum Number of Platforms Required

You are provided with two arrays, AT and DT, representing the arrival and departure times of all trains arriving at a railway station.

Your task is to determine the minimum ...read more

Ans.

This question asks to find the minimum number of platforms required at a railway station so that no train needs to wait.

  • Sort the arrival and departure times arrays in ascending order.

  • Initialize a variable 'platforms' to 1 and 'maxPlatforms' to 1.

  • Iterate through the arrival and departure times arrays simultaneously.

  • If the current arrival time is less than or equal to the current departure time, increment 'platforms'.

  • If 'platforms' is greater than 'maxPlatforms', update 'maxPla...read more

Add your answer
right arrow

Q8. Minimum Fountains Activation Problem

In this problem, you have a one-dimensional garden of length 'N'. Each position from 0 to 'N' has a fountain that can provide water to the garden up to a certain range. Thus...read more

Ans.

Find the minimum number of fountains to activate to water the entire garden.

  • Iterate through the array to find the coverage of each fountain.

  • Keep track of the farthest coverage reached by each activated fountain.

  • Activate the fountain that covers the farthest distance not yet covered.

  • Repeat until the entire garden is watered.

Add your answer
right arrow
Share interview questions and help millions of jobseekers 🌟
man with laptop

Q9. Problem: Sort an Array of 0s, 1s, and 2s

Given an array/list ARR consisting of integers where each element is either 0, 1, or 2, your task is to sort this array in increasing order.

Input:

The input starts with...read more
Ans.

Sort an array of 0s, 1s, and 2s in increasing order.

  • Use a three-pointer approach to sort the array in a single pass.

  • Initialize low, mid, and high pointers at the start, iterate through the array, and swap elements accordingly.

  • Example: If the current element is 0, swap it with the element at the low pointer and increment both low and mid pointers.

Add your answer
right arrow

Q10. Spiral Order Traversal of a Binary Tree Problem Statement

Given a binary tree with 'N' nodes, your task is to print the nodes in spiral order traversal.

Example:

Input:
The binary tree is represented in level o...read more
Ans.

Print nodes of a binary tree in spiral order traversal.

  • Use a queue to perform level order traversal.

  • Alternate between printing nodes from left to right and right to left at each level.

  • Handle null nodes appropriately.

  • Example: For input '1 2 3 -1 -1 4 5 -1 -1 -1 -1', output should be '1 3 2 4 5'.

Add your answer
right arrow

Q11. Clone Linked List with Random Pointer

Your task is to create a deep copy of a linked list, where each node has two pointers: one that points to the next node in the list, and a 'random' pointer which can point ...read more

Ans.

Create a deep copy of a linked list with random pointers.

  • Iterate through the original linked list and create a new node for each node in the list.

  • Store the mapping of original nodes to their corresponding new nodes in a hashmap.

  • Iterate through the list again to set the next and random pointers of the new nodes based on the mapping.

  • Return the head of the newly created deep copied linked list.

Add your answer
right arrow

Q12. Inorder Successor in a Binary Tree

Find the inorder successor of a given node in a binary tree. The inorder successor is the node that appears immediately after the given node during an inorder traversal. If th...read more

Ans.

Find the inorder successor of a given node in a binary tree.

  • Perform an inorder traversal of the binary tree to find the successor of the given node.

  • If the given node has a right child, the successor will be the leftmost node in the right subtree.

  • If the given node does not have a right child, backtrack to the parent nodes to find the successor.

Add your answer
right arrow

Q13. Delete Middle Node Problem Statement

You are given a singly linked list of integers. The task is to delete the middle node of this list.

Note:

1. If the list has no middle node, return an empty list (NULL). 2. ...read more
Ans.

Delete the middle node of a singly linked list in O(N) time complexity and O(1) space complexity.

  • Identify the middle node using slow and fast pointers technique.

  • Update the pointers to skip the middle node.

  • Handle edge cases like no middle node or two middle nodes.

  • Perform the deletion in a single traversal of the linked list.

  • Return the modified linked list after deletion.

Add your answer
right arrow

Q14. Bottom Right View of Binary Tree Problem Statement

Your task is to identify and return the bottom right view of a given binary tree.

This involves viewing the binary tree from an angle of 45 degrees from the bo...read more

Ans.

Identify and return the bottom right view of a given binary tree by viewing it from an angle of 45 degrees from the bottom right side.

  • Traverse the binary tree in a right-to-left manner and keep track of the last node encountered at each level.

  • Use a queue for level order traversal and update the result array with the last node at each level.

  • Return the result array sorted in ascending order as the bottom right view of the binary tree.

Add your answer
right arrow

Q15. Closest Leaf in a Binary Tree

Ninja is stuck in a maze represented as a binary tree, and he is at a specific node ‘X’. Help Ninja find the shortest path to the nearest leaf node, which is considered an exit poi...read more

Ans.

Find the minimum distance from a given node to the nearest leaf node in a binary tree.

  • Traverse the binary tree from the given node 'X' to find the nearest leaf node using BFS or DFS.

  • Keep track of the distance from 'X' to each leaf node encountered during traversal.

  • Return the minimum distance found as the output.

Add your answer
right arrow

Q16. All Pairs with Target Sum

Given an array of integers ARR with length 'N' and an integer 'Target', the task is to find all unique pairs of elements that add up to the 'Target'.

Input:

First line: Integer 'T' - n...read more
Ans.

Find all unique pairs of elements in an array that add up to a given target sum.

  • Use a hashmap to store the difference between the target sum and each element as keys and their indices as values.

  • Iterate through the array and check if the current element's complement exists in the hashmap.

  • Return the pairs of elements that add up to the target sum.

Add your answer
right arrow

Q17. Quick Sort Problem Statement

Sort the given array of integers in ascending order using the quick sort algorithm. Quick sort is a divide-and-conquer algorithm where a pivot point is chosen to partition the array...read more

Ans.

Implement quick sort algorithm to sort an array of integers in ascending order.

  • Choose a pivot element (e.g., rightmost element) to partition the array into two subarrays.

  • Recursively apply quick sort on the subarrays until the entire array is sorted.

  • Time complexity can be optimized to NlogN for worst-case scenarios.

Add your answer
right arrow

Q18. Container with Most Water Problem Statement

Given a sequence of 'N' space-separated non-negative integers A[1], A[2], ..., A[i], ..., A[n], where each number in the sequence represents the height of a line draw...read more

Ans.

Find two lines to form a container with maximum water capacity based on given heights.

  • Iterate through the array and use two pointers to find the maximum area.

  • Calculate the area using the formula: min(height[left], height[right]) * (right - left).

  • Move the pointer with the smaller height towards the center to potentially find a larger area.

Add your answer
right arrow

Q19. Maze Obstacle Problem Statement

Given an N * M grid representing a maze with obstacles, compute and return the total number of distinct paths from the top-left cell to the bottom-right cell. A cell in the maze ...read more

Ans.

Find the total number of distinct paths in a maze with obstacles from top-left to bottom-right cell.

  • Use dynamic programming to keep track of the number of paths to reach each cell.

  • Handle blocked cells by setting their path count to 0.

  • Only move right or down from any given cell to calculate the number of paths.

  • Return the total number of valid paths modulo 10^9 + 7.

Add your answer
right arrow

Q20. Minimize Cash Flow Problem

You are provided with a list of 'transactions' involving 'n' friends who owe each other money. Each entry in the list contains information about a receiver, sender, and the transactio...read more

Ans.

Minimize cash flow among friends by optimizing transactions.

  • Create a graph where nodes represent friends and edges represent transactions.

  • Calculate net amount each friend owes or is owed by summing up all transactions.

  • Use a recursive algorithm to minimize cash flow by settling debts between friends.

  • Update the graph after each settlement and continue until all debts are settled.

  • Output the minimized cash flow in a 2-D matrix for each test case.

Add your answer
right arrow

Q21. Next Greater Element Problem Statement

Given a list of integers of size N, your task is to determine the Next Greater Element (NGE) for every element. The Next Greater Element for an element X is the first elem...read more

Ans.

Given a list of integers, find the next greater element for each element in the list.

  • Iterate through the list from right to left and use a stack to keep track of elements.

  • Pop elements from the stack until a greater element is found or the stack is empty.

  • Store the next greater element for each element in a result array.

  • If no greater element is found, store -1 in the result array.

Add your answer
right arrow

Q22. Longest Common Subsequence Problem Statement

Given two strings STR1 and STR2, determine the length of their longest common subsequence.

A subsequence is a sequence that can be derived from another sequence by d...read more

Ans.

The task is to find the length of the longest common subsequence between two given strings.

  • Implement a function to find the longest common subsequence between two strings.

  • Use dynamic programming to solve this problem efficiently.

  • Iterate through the strings and build a matrix to store the lengths of common subsequences.

  • The value in the bottom-right corner of the matrix will be the length of the longest common subsequence.

Add your answer
right arrow

Q23. Group Anagrams Together

Given an array/list of strings STR_LIST, group the anagrams together and return each group as a list of strings. Each group must contain strings that are anagrams of each other.

Example:...read more

Ans.

Group anagrams together in a list of strings.

  • Iterate through the list of strings and sort each string to group anagrams together.

  • Use a hashmap to store the sorted string as key and the original string as value.

  • Return the values of the hashmap as the grouped anagrams.

Add your answer
right arrow

Q24. Job Sequencing Problem Statement

You are provided with a N x 2 2-D array called Jobs consisting of N jobs. In this array, Jobs[i][0] represents the deadline of the i-th job, while Jobs[i][1] indicates the profi...read more

Ans.

Maximize profit by scheduling jobs within their deadlines.

  • Sort the jobs array in descending order of profits.

  • Iterate through the sorted array and schedule jobs based on deadlines.

  • Keep track of completed jobs and their profits to calculate the total profit.

  • Return the maximum profit achieved by scheduling jobs within deadlines.

Add your answer
right arrow

Q25. Adding Two Linked Lists

Given two singly linked lists, with each list representing a positive number without leading zeros, your task is to add these two numbers and return the result in the form of a new linke...read more

Ans.

Add two numbers represented by linked lists and return the result as a new linked list.

  • Traverse both linked lists simultaneously while adding corresponding elements and carry over the sum if needed

  • Handle cases where one linked list is longer than the other

  • Create a new linked list to store the sum of the two numbers

Add your answer
right arrow

Q26. Merge Sort Task

Given a sequence of numbers, denoted as ARR, your task is to return a sorted sequence of ARR in non-descending order using the Merge Sort algorithm.

Example:

Explanation:
The Merge Sort algorith...read more
Ans.

Implement Merge Sort algorithm to sort a sequence of numbers in non-descending order.

  • Implement the Merge Sort algorithm which involves dividing the array into two halves, sorting each half, and then merging them back together.

  • Recursively call the Merge Sort function on each half of the array until the base case of having a single element in the array is reached.

  • Merge the sorted halves back together in a new array in non-descending order.

  • Ensure to handle the edge cases such as...read more

Add your answer
right arrow

Q27. Zigzag Traversal of Binary Tree

Given a binary tree with integer values in its nodes, your task is to print the zigzag traversal of the tree.

Note:

In zigzag order, level 1 is printed from left to right, level ...read more
Ans.

Implement a function to print the zigzag traversal of a binary tree.

  • Use a queue to perform level order traversal of the binary tree.

  • Maintain a flag to switch between printing nodes from left to right and right to left at each level.

  • Store nodes at each level in a list and reverse the list if the flag is set to print in zigzag order.

Add your answer
right arrow

Q28. Minimum Insertions to Make a String Palindrome

Determine the minimal number of characters needed to insert into a given string STR to transform it into a palindrome.

Example:

Input:
STR = "abcaa"
Output:
2
Expl...read more
Ans.

The task is to find the minimum number of characters needed to insert into a given string to make it a palindrome.

  • Use dynamic programming to find the longest palindromic subsequence of the given string.

  • Subtract the length of the longest palindromic subsequence from the length of the original string to get the minimum insertions required.

  • Handle edge cases like an empty string or a string that is already a palindrome.

  • Example: For input 'abcaa', the longest palindromic subsequen...read more

Add your answer
right arrow

Q29. Lexicographically Smallest Array Problem Statement

You are given an array ARR of 'N' integers and a positive integer 'K'.

Your task is to determine the lexicographically smallest array that can be obtained by p...read more

Ans.

The task is to determine the lexicographically smallest array that can be obtained by performing at most 'K' swaps of consecutive elements.

  • Sort the array in non-decreasing order and keep track of the number of swaps made.

  • Iterate through the array and swap adjacent elements if it results in a lexicographically smaller array.

  • Continue swapping until the maximum number of swaps 'K' is reached or the array is lexicographically smallest.

  • Return the final lexicographically smallest a...read more

Add your answer
right arrow

Q30. Find Subarray with Given Sum

Given an array ARR of N integers and an integer S, determine if there exists a subarray (of positive length) within the given array such that the sum of its elements equals S. If su...read more

Ans.

Given an array and a target sum, find a subarray that sums up to the target sum.

  • Iterate through the array while keeping track of the running sum and the starting index of the subarray.

  • Use a hashmap to store the running sum and its corresponding index.

  • If the running sum - target sum is found in the hashmap, it means a subarray with the target sum exists.

  • Return the starting and ending indices of the subarray or [-1, -1] if no such subarray exists.

Add your answer
right arrow

Q31. Floor Value of X Problem Statement

Given a sorted array A and an integer X, your task is to find and return the floor value of X in the array.

The floor value of X is the largest element in array A which is sma...read more

Ans.

Find the largest element in a sorted array smaller than or equal to a given integer X.

  • Use binary search to efficiently find the floor value of X in the sorted array.

  • Compare the middle element of the array with X and adjust the search accordingly.

  • Return the element before or equal to X as the floor value, or -1 if no such element exists.

Add your answer
right arrow

Q32. Write a function that returns '3' when '4' is passed as an input and vice versa without using if-else condition

Ans.

Function to swap '3' and '4' without using if-else

  • Use XOR operator to swap the values

  • Convert the input to ASCII code and perform the swap

  • Use a lookup table to map the values

Add your answer
right arrow

Q33. A 2D matrix is given which is row wise and column wise sorted. Find a particular element from it

Ans.

Finding an element in a sorted 2D matrix

  • Start from the top right corner or bottom left corner

  • Compare the target element with the current element

  • Move left or down if the target is smaller, else move right or up

  • Repeat until the target is found or all elements are checked

Add your answer
right arrow
Q34. What JavaScript questions did he ask you during the managerial round, and can you describe the work culture of his team?
Ans.

The interviewer asked about JavaScript questions and the work culture of the team during the managerial round.

  • JavaScript questions related to closures, prototypes, event handling, and asynchronous programming may have been asked.

  • Work culture may involve collaboration, innovation, agile methodologies, and continuous learning.

  • Examples of work culture could include regular team meetings, code reviews, hackathons, and mentorship programs.

Add your answer
right arrow

Q35. Find the odd repeating element from a set of repeating elements

Ans.

Find the odd repeating element from an array of strings

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

  • Iterate through the hash table to find the element with an odd count

Add your answer
right arrow

Q36. design dictionary using trie....having operations of inserting a word, updating and deleting (needed to write full running code)

Ans.

Design a dictionary using trie with insert, update and delete operations.

  • Implement a Trie data structure with nodes containing a character and a boolean flag to indicate end of word

  • For insert operation, traverse the trie and add nodes for each character in the word

  • For update operation, delete the existing word and insert the updated word

  • For delete operation, mark the end of word flag as false and delete the node if it has no children

  • Use recursion for traversal and deletion

  • Exa...read more

Add your answer
right arrow

Q37. Given a graph, print all the connected components in it.

Ans.

Print all the connected components in a given graph.

  • Traverse the graph using DFS or BFS algorithm.

  • Maintain a visited array to keep track of visited nodes.

  • For each unvisited node, perform DFS or BFS and add all visited nodes to a connected component.

  • Repeat until all nodes are visited.

  • Print all connected components.

Add your answer
right arrow

Q38. SQL Query to find Nth highest salary from table

Ans.

SQL query to find Nth highest salary from table

  • Use ORDER BY and LIMIT clauses

  • Use subquery to get the Nth highest salary

  • Handle cases where there are less than N distinct salaries

Add your answer
right arrow

Q39. Puzzle on measuring exactly half a glass of water

Ans.

Fill the glass to the brim, then pour out exactly half.

  • Fill the glass completely with water

  • Pour the water into another container until the glass is half full

  • Pour the remaining water back into the glass

Add your answer
right arrow

Q40. Write a program to find Minimum length of string in 'bdcabdcbaabbbac' containing substring 'abc'

Ans.

A program to find the minimum length of a string containing a given substring.

  • Use a sliding window approach to iterate through the string and check for the substring.

  • Keep track of the minimum length of the string containing the substring.

  • Return the minimum length found.

Add your answer
right arrow

Q41. Write a program to Create a spiral array using 2D-array

Ans.

Program to create a spiral array using 2D-array

  • Create a 2D-array with given dimensions

  • Initialize variables for row, column, and direction

  • Fill the array in a spiral pattern by changing direction when necessary

  • Return the spiral array

Add your answer
right arrow
Q42. What is sharding?
Ans.

Sharding is a database partitioning technique to improve performance and scalability by distributing data across multiple servers.

  • Sharding involves breaking up a database into smaller, more manageable parts called shards.

  • Each shard contains a subset of the data, allowing for parallel processing and improved performance.

  • Sharding helps distribute the workload across multiple servers, preventing bottlenecks and improving scalability.

  • Examples of sharding implementations include M...read more

Add your answer
right arrow

Q43. Types of DS and a real life scenario.

Ans.

Types of DS and a real life scenario

  • Arrays - storing a list of names

  • Linked Lists - managing a playlist

  • Stacks - undo/redo functionality in text editors

  • Queues - managing customer requests in a call center

  • Trees - organizing files in a computer

  • Graphs - social network connections

Add your answer
right arrow

Q44. OOPs in python and explain them

Ans.

OOPs in Python refers to Object-Oriented Programming concepts like classes, objects, inheritance, encapsulation, and polymorphism.

  • Classes: Blueprint for creating objects with attributes and methods.

  • Objects: Instances of classes that contain data and behavior.

  • Inheritance: Ability to create a new class based on an existing class.

  • Encapsulation: Restricting access to certain components of an object.

  • Polymorphism: Ability to use a single interface for different data types.

Add your answer
right arrow

Q45. what is multithreading

Ans.

Multithreading is the ability of a CPU to execute multiple threads concurrently.

  • Allows for parallel execution of tasks

  • Improves performance by utilizing multiple CPU cores

  • Requires synchronization to prevent race conditions

  • Example: Running a web server that can handle multiple client requests simultaneously

Add your answer
right arrow

Q46. Build Basic LRU without Libraries

Ans.

Implement a basic LRU cache without using libraries

  • Create a data structure to store key-value pairs with a fixed size

  • Use a doubly linked list to keep track of the most recently used items

  • Implement methods to add, access, and remove items based on their usage

  • Update the linked list whenever an item is accessed or added

Add your answer
right arrow
Contribute & help others!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos

Interview Process at Paytm Software Developer

based on 25 interviews
4 Interview rounds
Coding Test Round
Technical Round
One-on-one Round
HR Round
View more
interview tips and stories logo
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Top Software Developer Interview Questions from Similar Companies

Google Logo
4.4
 • 85 Interview Questions
TCS iON Logo
3.9
 • 35 Interview Questions
View all
Recently Viewed
REVIEWS
Broadridge Financial Solutions
No Reviews
INTERVIEWS
Paytm
Fresher
90 top interview questions
INTERVIEWS
Wipro
Fresher
400 top interview questions
REVIEWS
Broadridge Financial Solutions
No Reviews
LIST OF COMPANIES
Onicra Credit Rating Agency
Locations
JOBS
Broadridge Financial Solutions
No Jobs
REVIEWS
Broadridge Financial Solutions
No Reviews
REVIEWS
Broadridge Financial Solutions
No Reviews
JOBS
Vishleshan Software Solutions
No Jobs
SALARIES
Wipro
Share an Interview
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
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