Add office photos
Paytm logo
Engaged Employer

Paytm

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

10+ Paytm Software Developer Interview Questions and Answers for Freshers

Updated 5 Feb 2024

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. 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

Q3. 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

Q4. 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
Discover Paytm interview dos and don'ts from real experiences

Q5. 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

Q6. 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
Are these interview questions helpful?

Q7. 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

Q8. 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
Share interview questions and help millions of jobseekers 🌟
man with laptop

Q9. 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

Q10. 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

Q11. 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

Q12. 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

Q13. 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

Q14. 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

Q15. 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

Q16. 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
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 for Freshers

based on 1 interviews
1 Interview rounds
Coding Test 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

View all
Recently Viewed
INTERVIEWS
Persistent Systems
10 top interview questions
LIST OF COMPANIES
Insolutions Global
Locations
SALARIES
Wipro
INTERVIEWS
Vista Foundation
10 top interview questions
SALARIES
Broadridge Financial Solutions
INTERVIEWS
Wissen Technology
Fresher
5.6k top interview questions
SALARIES
Insolutions Global
REVIEWS
Broadridge Financial Solutions
No Reviews
REVIEWS
Broadridge Financial Solutions
No Reviews
REVIEWS
Broadridge Financial Solutions
No Reviews
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