Add office photos
Engaged Employer

Paytm

3.3
based on 7.4k Reviews
Video summary
Filter interviews by

90+ NTPC Interview Questions and Answers

Updated 23 Dec 2024
Popular Designations

Q1. Generate Binary Strings with No Consecutive 1s

Given an integer K, your task is to produce all binary strings of length 'K' that do not contain consecutive '1's.

Input:

The input begins with an integer 'T', the...read more
Ans.

Generate all binary strings of length 'K' with no consecutive '1's in lexicographically increasing order.

  • Use backtracking to generate all possible binary strings without consecutive '1's.

  • Start with an empty string and recursively add '0' or '1' based on the condition.

  • Keep track of the current string and its length to ensure no consecutive '1's are added.

  • Sort the generated strings in lexicographically increasing order before outputting.

Add your answer

Q2. Longest Consecutive Sequence Problem Statement

You are provided with an unsorted array/list ARR of N integers. Your task is to determine the length of the longest consecutive sequence present in the array.

Expl...read more

Ans.

The task is to find the length of the longest consecutive sequence in an unsorted array of integers.

  • Iterate through the array and store all elements in a set for constant time lookup.

  • For each element, check if it is the start of a sequence by looking for element-1 in the set.

  • If it is the start, keep incrementing the count until the next element is not found in the set.

View 1 answer

Q3. SpecialStack Design Problem

Design a stack that efficiently supports the getMin() operation in O(1) time with O(1) extra space. This stack should include the following operations: push(), pop(), top(), isEmpty(...read more

Ans.

Design a stack that supports getMin() operation in O(1) time with O(1) extra space using inbuilt stack data structure.

  • Use two stacks - one to store the actual data and another to store the minimum value at each level.

  • When pushing a new element, check if it is smaller than the current minimum and update the minimum stack accordingly.

  • When popping an element, also pop the top element from the minimum stack if it matches the popped element.

  • For getMin() operation, simply return th...read more

Add your answer

Q4. Subsequence Determination Problem

Your task is to verify if the given string STR1 is a subsequence of the string STR2. A subsequence means characters from STR2 are retained in their original order but some (or ...read more

Ans.

Verify if a string is a subsequence of another string by checking if characters are retained in order.

  • Iterate through both strings simultaneously, checking if characters match in order.

  • If a character in STR1 matches a character in STR2, move to the next character in STR2.

  • If all characters in STR1 are found in STR2 in order, return True; otherwise, return False.

Add your answer
Discover NTPC interview dos and don'ts from real experiences

Q5. Segregate Even and Odd Nodes in a Linked List

You are given the head node of a singly linked list head. Your task is to modify the linked list so that all the even-valued nodes appear before all the odd-valued ...read more

Ans.

Reorder a singly linked list so that all even-valued nodes appear before odd-valued nodes while preserving the original order.

  • Create two separate linked lists for even and odd nodes

  • Traverse the original list and move nodes to respective even or odd lists

  • Merge the even and odd lists while maintaining the original order

Add your answer

Q6. Ninja Technique Problem Statement

Implement a function that determines whether a given numeric string contains any substring whose integer value equals the product of two consecutive integers. The function shou...read more

Ans.

Implement a function to determine if a numeric string contains a substring whose value equals the product of two consecutive integers.

  • Iterate through all substrings of the input string and check if their integer value equals the product of two consecutive integers.

  • Use nested loops to generate all possible substrings efficiently.

  • Check if the product of two consecutive integers matches the integer value of the substring.

  • Return 'True' if any such substring is found, otherwise re...read more

Add your answer
Are these interview questions helpful?

Q7. Find Nodes at a Specific Distance from Target in a Binary Tree

Given a binary tree, a target node within this tree, and an integer K, identify and return all nodes that are exactly K edges away from the target ...read more

Ans.

Find nodes at a specific distance from a target node in a binary tree.

  • Traverse the binary tree to find the target node.

  • Perform a depth-first search to identify nodes at distance K from the target node.

  • Return the values of nodes found at distance K in an array.

Add your answer

Q8. Subtree of Another Tree Problem Statement

Given two binary trees, T and S, determine whether S is a subtree of T. The tree S should have the same structure and node values as a subtree of T.

Explanation:

A subt...read more

Ans.

Given two binary trees T and S, determine if S is a subtree of T with the same structure and node values.

  • Traverse through tree T and check if any subtree matches tree S

  • Use recursion to compare nodes of both trees

  • Handle edge cases like null nodes and empty trees

Add your answer
Share interview questions and help millions of jobseekers 🌟

Q9. Ways To Make Coin Change

Given an infinite supply of coins of varying denominations, determine the total number of ways to make change for a specified value using these coins. If it's not possible to make the c...read more

Ans.

The task is to determine the total number of ways to make change for a specified value using given denominations.

  • Use dynamic programming to keep track of the number of ways to make change for each value up to the target value.

  • Iterate through each denomination and update the number of ways to make change for each value based on the current denomination.

  • Handle base cases such as making change for 0 or using only the smallest denomination.

  • Consider edge cases like having a single...read more

Add your answer

Q10. Minimum Subset Sum Difference Problem

Given an array of non-negative integers, your task is to partition this array into two subsets such that the absolute difference between the sums of the subsets is minimize...read more

Ans.

Given an array, partition it into two subsets to minimize the absolute difference between their sums.

  • Use dynamic programming to calculate all possible subset sums.

  • Iterate through the subset sums to find the minimum absolute difference.

  • Consider all possible partitions of the array elements.

  • Example: For input [1, 6, 11, 5], the minimum absolute difference is 1.

  • Example: For input [1, 2, 3], the minimum absolute difference is 0.

Add your answer

Q11. Minimum Falling Path Sum Problem Statement

Given a square array VEC of integers with N rows and N columns, you need to determine the minimum sum of a falling path through this square array. The array has equal ...read more

Ans.

Find the minimum sum of a falling path through a square array by selecting one element from each row with constraints on column selection.

  • Iterate through the array from the second row, updating each element with the minimum sum of the element and its adjacent elements from the previous row.

  • The minimum sum path will end in the last row with the minimum value.

  • Use dynamic programming to efficiently calculate the minimum falling path sum.

  • Example: For input [[5, 10], [25, 15]], th...read more

Add your answer

Q12. String Transformation Problem

Given a string (STR) of length N, you are tasked to create a new string through the following method:

Select the smallest character from the first K characters of STR, remove it fr...read more

Ans.

Given a string and an integer K, create a new string by selecting the smallest character from the first K characters of the input string and repeating the process until the input string is empty.

  • Iterate through the input string, selecting the smallest character from the first K characters each time.

  • Remove the selected character from the input string and append it to the new string.

  • Continue this process until the input string is empty.

  • Return the final new string formed.

Add your answer

Q13. Geometric Progression Subsequences Problem Statement

Given an array of ‘N’ integers, determine the number of subsequences of length 3 that form a geometric progression with a specified common ratio ‘R’.

Explana...read more

Ans.

Count the number of subsequences of length 3 forming a geometric progression with a specified common ratio in an array of integers.

  • Iterate through the array and for each element, check for possible subsequences of length 3 with the given common ratio.

  • Use a hashmap to store the count of possible subsequences for each element as the middle element.

  • Return the total count of subsequences modulo 10^9 + 7.

  • Example: For input [2, 4, 8, 16] and common ratio 2, the only subsequence [2,...read more

Add your answer

Q14. Group Anagrams Problem Statement

Given an array or list of strings called inputStr, your task is to return the strings grouped as anagrams. Each group should contain strings that are anagrams of one another.

An...read more

Ans.

Group anagrams in an array of strings based on their characters.

  • Iterate through each string in the input array/list.

  • For each string, sort the characters alphabetically to create a key for grouping.

  • Use a hashmap to group strings with the same key.

  • Return the grouped anagrams as separate arrays of strings.

Add your answer

Q15. Middle of a Linked List

You are given the head node of a singly linked list. Your task is to return a pointer pointing to the middle of the linked list.

If there is an odd number of elements, return the middle ...read more

Ans.

Return the middle element of a singly linked list, or the one farther from the head node if there are even elements.

  • Traverse the linked list with two pointers, one moving twice as fast as the other

  • When the fast pointer reaches the end, the slow pointer will be at the middle

  • Return the element pointed to by the slow pointer

Add your answer

Q16. Distinct Subsets Count

Given an array arr of N integers that may include duplicates, determine the number of subsets of this array containing only distinct elements.

The result should be returned modulo 109 + 7...read more

Ans.

Count the number of distinct-element subsets in an array modulo 10^9+7.

  • Iterate through the array and keep track of distinct elements using a set.

  • Calculate the number of subsets using the formula 2^distinct_count - 1.

  • Return the result modulo 10^9+7 for each test case.

Add your answer

Q17. Sort an Array in Wave Form

You are given an unsorted array ARR. Your task is to sort it so that it forms a wave-like array.

Input:

The first line contains an integer 'T', the number of test cases.
For each test ...read more
Ans.

Sort an array in wave form where each element is greater than or equal to its adjacent elements.

  • Iterate through the array and swap adjacent elements to form a wave pattern.

  • Ensure that the first element is greater than or equal to the second element.

  • There can be multiple valid wave arrays, so any valid wave array is acceptable.

Add your answer

Q18. Reverse a Linked List Problem Statement

You are given a Singly Linked List of integers. Your task is to reverse the Linked List by changing the links between nodes.

Input:

The first line of input contains a sin...read more
Ans.

Reverse a given singly linked list by changing the links between nodes.

  • Iterate through the linked list and reverse the links between nodes

  • Use three pointers to keep track of the current, previous, and next nodes

  • Update the links between nodes to reverse the list

  • Return the head of the reversed linked list

Add your answer

Q19. Replace 0s Problem Statement

You are given a matrix where every element is either a 1 or a 0. The task is to replace 0 with 1 if it is surrounded by 1s. A 0 (or a set of 0s) is considered to be surrounded by 1s...read more

Ans.

Given a matrix of 1s and 0s, replace 0s surrounded by 1s with 1s.

  • Iterate through the matrix and check each 0 surrounded by 1s.

  • If a 0 is surrounded by 1s, replace it with 1.

  • Update the matrix in place without printing or returning it.

Add your answer

Q20. Kth Smallest Element Problem Statement

You are provided with an array of integers ARR of size N and an integer K. Your task is to find and return the K-th smallest value present in the array. All elements in th...read more

Ans.

Find the K-th smallest element in a given array of distinct integers.

  • Sort the array in ascending order.

  • Return the element at index K-1 from the sorted array.

  • Handle edge cases like K being out of bounds or array being empty.

Add your answer

Q21. Distributing Coins in a Binary Tree

You are provided with the root of a binary tree that consists of 'N' nodes. Each node in this tree contains coins, and the total number of coins across all nodes is equal to ...read more

Ans.

Determine the minimum number of moves required to distribute coins in a binary tree so that every node has exactly one coin.

  • Traverse the binary tree in a bottom-up manner to distribute coins efficiently.

  • Keep track of the excess or deficit of coins at each node to calculate the minimum moves required.

  • Transfer coins from nodes with excess coins to nodes with deficits to balance the distribution.

  • Example: For the input ROOT = [2, -1, 0, -1, -1], the output is 1 as one move is nee...read more

Add your answer

Q22. 0-1 Knapsack Problem Statement

A thief is robbing a store and can carry a maximal weight 'W' in his knapsack. There are 'N' items, where the i-th item has a weight 'wi' and value 'vi'. Consider the maximum weig...read more

Ans.

The 0-1 Knapsack Problem involves maximizing the value of items a thief can steal within a weight limit.

  • Use dynamic programming to solve the problem efficiently.

  • Create a 2D array to store the maximum value that can be achieved at each weight limit.

  • Iterate through the items and weights to fill the array with optimal values.

  • Return the maximum value achievable at the given weight limit.

Add your answer

Q23. Permutations Problem Statement

Given an array of distinct integers, find all possible permutations of the array.

Explanation:

A permutation is a mathematical way of determining the number of possible arrangemen...read more

Ans.

Find all possible permutations of an array of distinct integers.

  • Use backtracking to generate all possible permutations

  • Swap elements to create different permutations

  • Return the permutations as an array of arrays of integers

Add your answer

Q24. Running Median Problem

Given a stream of integers, calculate and print the median after each new integer is added to the stream.

Output only the integer part of the median.

Example:

Input:
N = 5 
Stream = [2, 3,...read more
Ans.

Calculate and print the median after each new integer is added to the stream.

  • Use a min heap to store the larger half of the numbers and a max heap to store the smaller half.

  • Keep the two heaps balanced by ensuring the size difference is at most 1.

  • If the total number of elements is odd, the median is the top of the larger heap. If even, average the tops of both heaps.

Add your answer
Q25. Can you explain the implementation of an LRU (Least Recently Used) Cache in a database management system?
Ans.

LRU cache in a database management system stores most recently used data and removes least recently used data when full.

  • LRU cache is implemented using a doubly linked list and a hash map.

  • Each node in the linked list represents a key-value pair.

  • When a key is accessed, it is moved to the front of the linked list.

  • If the cache is full, the least recently used node at the end of the list is removed.

  • Example: If cache size is 3 and keys accessed in order are A, B, C, D, A, then afte...read more

Add your answer
Q26. What are the conditions for a deadlock to occur?
Ans.

Deadlock occurs when two or more processes are waiting for each other to release resources, resulting in a standstill.

  • Two or more processes must be holding resources and waiting for resources held by other processes

  • Processes cannot proceed because they are stuck in a circular wait

  • Resources cannot be forcibly released by the operating system

  • Examples: Process A holds Resource 1 and waits for Resource 2, while Process B holds Resource 2 and waits for Resource 1

Add your answer
Q27. Design a stack that supports the getMin() operation in O(1) time and O(1) extra space.
Ans.

Use two stacks - one to store actual values and one to store minimum values.

  • Use two stacks - one to store actual values and one to store minimum values

  • When pushing a new value, check if it is smaller than the current minimum and push it to the min stack if so

  • When popping a value, check if it is the current minimum and pop from min stack if so

  • getMin() operation can be done by peeking at the top of the min stack

Add your answer

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

Q29. Check wether a given binary tree is a BST or not

Ans.

To check if a binary tree is a BST, we can perform an in-order traversal and ensure that the elements are in sorted order.

  • Perform an in-order traversal of the binary tree

  • Check if the elements are in sorted order

  • If any element is not in sorted order, then the tree is not a BST

Add your answer

Q30. Merge sort using Linked list ( psuedo code )

Ans.

Merge sort using linked list is a sorting algorithm that divides the list into smaller sublists, sorts them, and then merges them back together.

  • Create a function to merge two sorted linked lists

  • Divide the linked list into two halves using slow and fast pointers

  • Recursively sort the two halves

  • Merge the sorted halves back together

Add your answer

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

Q32. Sum of Squares of First N Natural Numbers Problem Statement

You are tasked with finding the sum of squares of the first N natural numbers for given test cases.

Input:

The first line contains an integer 'T', the...read more
Ans.

The task is to find the sum of squares of the first 'N' natural numbers.

  • Iterate from 1 to N and calculate the square of each number

  • Add all the squares together to get the final sum

  • Return the sum as the result

Add your answer

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

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

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

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

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

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

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

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

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

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

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

Q44. how web/internet works?

Ans.

The web/internet is a network of interconnected devices that communicate through standardized protocols to share information.

  • Devices connect to the internet through ISPs

  • Data is transmitted through packets using TCP/IP protocols

  • Web browsers use HTTP/HTTPS protocols to request and receive web pages

  • DNS servers translate domain names to IP addresses

  • Web servers host web pages and respond to requests

  • Search engines use web crawlers to index web pages for search results

Add your answer

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

Q46. Whole garbage collector and its process in java

Ans.

Garbage collector in Java manages memory allocation and deallocation automatically.

  • Garbage collector runs in the background and frees up memory that is no longer in use.

  • It uses different algorithms like Mark and Sweep, Copying, and Generational.

  • System.gc() can be used to request garbage collection, but it's not guaranteed to run immediately.

  • Garbage collector can cause performance issues if not tuned properly.

  • Java provides tools like jstat and jvisualvm to monitor and analyze ...read more

Add your answer

Q47. Write program for internal implementation of hash map

Ans.

Program for internal implementation of hash map

  • Define a hash function to map keys to indices in an array

  • Create an array of linked lists to handle collisions

  • Implement methods for adding, removing, and retrieving key-value pairs

  • Consider resizing the array when it becomes too full

  • Handle edge cases such as null keys or values

Add your answer

Q48. Design round | Design a notification service

Ans.

Design a notification service for sending real-time alerts to users.

  • Use a scalable messaging system like Kafka or RabbitMQ to handle high volume of notifications.

  • Implement a user preference system to allow users to choose their preferred notification channels (email, SMS, push notifications, etc).

  • Include a scheduling feature to send notifications at specific times or intervals.

  • Ensure notifications are personalized and relevant to each user based on their activity or preferenc...read more

Add your answer

Q49. Do you know how market accept the new product?

Ans.

Market acceptance of new product depends on various factors such as product features, pricing, competition, and marketing strategies.

  • Conducting market research to understand customer needs and preferences

  • Analyzing competitor products and pricing strategies

  • Developing effective marketing campaigns to create awareness and generate interest

  • Offering competitive pricing and attractive promotions

  • Collecting feedback from early adopters and making necessary improvements

  • Monitoring sale...read more

View 14 more answers

Q50. Are you agree to visit merchant physically in market ?

Ans.

Yes, I am willing to visit merchants physically in the market.

  • I believe that face-to-face interaction is crucial in building strong relationships with clients.

  • Visiting merchants in the market allows me to understand their needs and concerns better.

  • It also gives me the opportunity to showcase our products and services in person.

  • I am comfortable with traveling and have a flexible schedule to accommodate market visits.

View 13 more answers

Q51. BST Iterator Problem Statement

You are tasked with creating a class named BSTIterator that acts as an iterator for the inorder traversal of a binary search tree. Implement the following functions:

  1. BSTIterator(...read more
Ans.

Create a BSTIterator class for inorder traversal of a binary search tree.

  • Implement a constructor that takes the root of the binary search tree and initializes the iterator.

  • Implement next() function to return the next smallest element in the inorder traversal.

  • Implement hasNext() function to check if there is a next element in the inorder traversal.

  • Traverse the binary search tree in inorder to get the desired output.

Add your answer

Q52. Cube Sum Pairs Problem Statement

Given a positive integer N, find the number of ways to express N as a sum of cubes of two integers, A and B, such that:

N = A^3 + B^3

Ensure you adhere to the following conditio...read more

Ans.

The problem involves finding the number of ways to express a given positive integer as a sum of cubes of two integers.

  • Iterate through all possible values of A and B within the given constraints.

  • Check if A^3 + B^3 equals the given N, increment the count if true.

  • Handle the case where A = B separately to avoid counting duplicates.

Add your answer

Q53. Parth's OCD Challenge

Parth, a budding programmer, has received an array 'ARR' of 'N' positive integers. His OCD is triggered whenever an odd number appears at an even index or an even number at an odd index in...read more

Ans.

Reorder array to avoid odd numbers at even indices and even numbers at odd indices.

  • Swap odd numbers at even indices with the nearest odd number at an odd index.

  • Swap even numbers at odd indices with the nearest even number at an even index.

  • Maintain counts of odd and even numbers to ensure equal distribution.

View 1 answer

Q54. Colorful Knapsack Problem

You are given a set of 'N' stones, each with a specific weight and color. The goal is to fill a knapsack with exactly 'M' stones, choosing one stone of each color, so that the total we...read more

Ans.

The Colorful Knapsack Problem involves selecting one stone of each color to fill a knapsack with a given weight capacity, minimizing unused capacity.

  • Iterate through the stones and keep track of the minimum weight for each color.

  • Use dynamic programming to find the optimal solution by considering all possible combinations.

  • Handle cases where the knapsack cannot be filled under the given conditions by returning -1.

  • In the given example, the optimal solution is to select stones wit...read more

Add your answer

Q55. Integer to Roman Conversion

Given an integer N, convert it to its corresponding Roman numeral representation. Roman numerals comprise seven symbols: I, V, X, L, C, D, and M.

Example:

Input:
N = 2
Output:
II
Exp...read more
Ans.

Convert an integer to its corresponding Roman numeral representation.

  • Create a mapping of integer values to Roman numeral symbols.

  • Iterate through the mapping in descending order of values and build the Roman numeral representation.

  • Subtract the largest possible value from the integer at each step and append the corresponding Roman numeral symbol.

  • Repeat until the integer becomes 0.

Add your answer
Q56. What is the order of execution of SQL clauses?
Ans.

The order of execution of SQL clauses is: SELECT, FROM, WHERE, GROUP BY, HAVING, ORDER BY.

  • The SELECT clause is executed first to retrieve the desired columns from the table.

  • The FROM clause is executed next to specify the table(s) from which the data is retrieved.

  • The WHERE clause is executed after the FROM clause to filter the rows based on specified conditions.

  • The GROUP BY clause is executed to group the rows based on specified columns.

  • The HAVING clause is executed after the ...read more

View 1 answer

Q57. Find All Occurrences in Matrix

You are provided with a matrix of characters, CHARACTER_MATRIX of size M x N, and a string WORD. Your goal is to locate and display all occurrences of the string within the matrix...read more

Ans.

Find all occurrences of a given string in a matrix in all eight possible directions.

  • Iterate through each cell in the matrix and check for the starting character of the word.

  • For each starting character found, check in all eight directions for the complete word.

  • Keep track of the coordinates of each character in the word for each occurrence.

  • Print the coordinates of each character for all occurrences found.

  • If no occurrences are found, output 'No match found'.

Add your answer

Q58. Diagonal Traversal of a Binary Tree

Given a binary tree of integers, find its diagonal traversal. Refer to the example for clarification on diagonal traversal.

Example:

Explanation:
Consider lines at an angle o...read more
Ans.

Find the diagonal traversal of a binary tree of integers.

  • Traverse the binary tree diagonally using a queue and a map to store nodes at each diagonal level.

  • Use a depth-first search approach to traverse the tree and populate the map with nodes at each diagonal level.

  • Iterate through the map to get the diagonal traversal of the binary tree.

Add your answer

Q59. Buy and Sell Stock Problem Statement

Imagine you are Harshad Mehta's friend, and you have been given the stock prices of a particular company for the next 'N' days. You can perform up to two buy-and-sell transa...read more

Ans.

Given stock prices for 'N' days, find maximum profit with up to two buy-and-sell transactions.

  • Iterate through the array of stock prices to find the maximum profit with two transactions

  • Keep track of the maximum profit by considering all possible buy and sell combinations

  • Ensure to sell the stock before buying again to maximize profit

Add your answer

Q60. Rahul And Minimum Subarray Challenge

Rahul is learning about arrays and lists. His teacher gave him a task to find the length of the smallest subarray in a given array 'ARR' of size 'N' with its sum greater tha...read more

Ans.

Find the length of the smallest subarray in a given array with sum greater than a given value.

  • Iterate through the array while keeping track of the current subarray sum.

  • Use two pointers technique to find the smallest subarray with sum greater than X.

  • Update the minimum subarray length as you iterate through the array.

  • Return the length of the smallest subarray found.

  • Example: For ARR = [1, 2, 21, 7, 6, 12] and X = 23, the output is 2.

Add your answer

Q61. Print Nodes at Distance K from a Given Node

Given an arbitrary binary tree, a node of the tree, and an integer 'K', find all nodes that are at a distance K from the specified node, and return a list of these no...read more

Ans.

Given a binary tree, a target node, and an integer K, find all nodes at distance K from the target node.

  • Traverse the binary tree to find the target node.

  • From the target node, perform a depth-first search to find nodes at distance K.

  • Use a recursive function to keep track of the distance from the target node.

  • Return the values of nodes found at distance K in any order.

Add your answer

Q62. Binary Tree Diameter Problem Statement

You are given a Binary Tree, and you need to determine the length of the diameter of the tree.

The diameter of a binary tree is the length of the longest path between any ...read more

Ans.

The task is to find the diameter of a binary tree, which is the longest path between any two nodes in the tree.

  • Traverse the tree to find the longest path between any two nodes.

  • Keep track of the maximum diameter found during traversal.

  • The diameter may not necessarily pass through the root node.

  • Consider both left and right subtrees while calculating the diameter.

  • Example: For input '1 2 3 4 -1 5 6 -1 7 -1 -1 -1 -1 -1 -1', the diameter is 6.

Add your answer

Q63. Find All Pairs Adding Up to Target

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

Input:

The first line conta...read more
Ans.

Given an array of integers and a target, find all pairs of elements that add up to the target.

  • Iterate through the array and for each element, check if the target minus the element exists in a hash set.

  • If it does, add the pair to the result. If not, add the element to the hash set.

  • Handle cases where the same element is used twice in a pair.

  • Return (-1, -1) if no pair is found.

Add your answer

Q64. Reverse the String Problem Statement

You are given a string STR which contains alphabets, numbers, and special characters. Your task is to reverse the string.

Example:

Input:
STR = "abcde"
Output:
"edcba"

Input...read more

Ans.

Reverse a given string containing alphabets, numbers, and special characters.

  • Iterate through the characters of the string from end to start and append them to a new string.

  • Use built-in functions like reverse() or StringBuilder in languages like Python or Java for efficient reversal.

  • Handle special characters and numbers along with alphabets while reversing the string.

  • Ensure to consider the constraints on the number of test cases and the length of the input string.

Add your answer
Q65. ...read more

Number and Digits Problem Statement

You are provided with a positive integer N. Your task is to identify all numbers such that the sum of the number and its digits equals N.

Example:

Input:
N = 21
Output:
[15]
Ans.

Identify numbers whose sum of digits and number equals given integer N.

  • Iterate through numbers from 1 to N and check if sum of number and its digits equals N.

  • Use a helper function to calculate sum of digits for a given number.

  • Return the numbers that satisfy the condition in increasing order, else return -1.

Add your answer

Q66. Encrypt The Digits Problem Statement

Given a numeric string STR consisting of characters from ‘0’ to ‘9’, encrypt the string by replacing each numeric character according to the mapping:
‘0’ -> ‘9’, ‘1’ -> ‘8’, ...read more

Ans.

Encrypt each digit in a numeric string by replacing it with its encrypted equivalent.

  • Iterate through each character in the string and replace it with its encrypted equivalent

  • Use a mapping to determine the encrypted equivalent of each digit

  • Return the encrypted string for each test case

Add your answer
Q67. How do you find the count of visitors that came today and the count of new visitors that arrived today?
Ans.

To find the count of visitors and new visitors that came today in a database management system (DBMS).

  • Use a query to filter the visitors based on the current date.

  • Count the total number of visitors using the COUNT function.

  • To find new visitors, compare the current date with the date of their first visit.

  • Use the DISTINCT keyword to count only unique new visitors.

Add your answer

Q68. Subset Sum Equal To K Problem Statement

Given an array/list of positive integers and an integer K, determine if there exists a subset whose sum equals K.

Provide true if such a subset exists, otherwise return f...read more

Ans.

Given an array of positive integers and an integer K, determine if there exists a subset whose sum equals K.

  • Use dynamic programming to solve this problem efficiently

  • Create a 2D array to store if a subset sum is possible for each element and sum

  • Iterate through the array and update the 2D array accordingly

  • Check if the subset sum for K is possible using the 2D array

Add your answer
Q69. What are underfitting and overfitting in machine learning models?
Ans.

Underfitting and overfitting are common problems in machine learning models.

  • Underfitting occurs when a model is too simple and fails to capture the underlying patterns in the data.

  • Overfitting happens when a model is too complex and learns the noise or random fluctuations in the training data.

  • Underfitting leads to high bias and low variance, while overfitting leads to low bias and high variance.

  • To address underfitting, we can increase model complexity, gather more data, or use...read more

Add your answer
Q70. Find the department-wise highest salary of the employees.
Ans.

The query finds the highest salary for each department.

  • Use the GROUP BY clause to group the employees by department.

  • Use the MAX() function to find the highest salary for each department.

  • Combine the MAX() function with the GROUP BY clause to get the department wise highest salary.

View 1 answer
Q71. How can you find the monthly salary of each employee?
Ans.

To find the salary of each employee per month, you need access to a database management system (DBMS) that stores employee data.

  • Access the DBMS and locate the table that stores employee information.

  • Identify the column that contains the salary information.

  • Retrieve the salary data for each employee and calculate the monthly salary.

  • Store the monthly salary information in a suitable data structure, such as an array of strings.

Add your answer
Q72. Can you explain the concept of Random Forest?
Ans.

Random Forest is an ensemble learning method that combines multiple decision trees to make predictions.

  • Random Forest is a supervised learning algorithm used for both classification and regression tasks.

  • It creates a multitude of decision trees and combines their predictions to make a final prediction.

  • Each decision tree is trained on a random subset of the training data and features.

  • Random Forest reduces overfitting and improves accuracy compared to a single decision tree.

  • It ca...read more

Add your answer

Q73. How can you be helpful to organisation?

Ans.

I can be helpful to the organization by analyzing data, identifying trends, and providing insights to support decision-making.

  • Conduct thorough data analysis to identify patterns and trends

  • Generate reports and presentations to communicate findings to stakeholders

  • Collaborate with cross-functional teams to provide insights and recommendations

  • Utilize tools such as Excel, SQL, and Tableau to analyze and visualize data

Add your answer

Q74. What is the difference between Sales and Marketing

Ans.

Sales focuses on selling products or services, while marketing focuses on promoting and creating demand for those products or services.

  • Sales involves direct interaction with customers to close deals

  • Marketing involves creating strategies to attract and retain customers

  • Sales is more short-term focused on closing deals, while marketing is more long-term focused on building brand awareness

  • Sales is more transactional, while marketing is more relationship-oriented

  • Examples: Salesper...read more

Add your answer

Q75. Can you sell 10 Paytm Devices in one month alongwith so byproducts as well

Ans.

Yes, I can sell 10 Paytm Devices in one month along with the byproducts.

  • I have a proven track record of exceeding sales targets in my previous roles.

  • I will utilize my strong communication and negotiation skills to pitch the benefits of Paytm Devices to potential customers.

  • I will leverage my network and contacts to reach out to potential clients and generate leads.

  • I will offer attractive deals and promotions to incentivize customers to purchase the devices and byproducts.

  • I wil...read more

Add your answer

Q76. Java coding with String / Array

Ans.

Java coding with String / Array involves manipulating arrays of strings using Java programming language.

  • Use String array to store multiple strings.

  • Access elements in the array using index.

  • Perform operations like sorting, searching, or concatenation on the array.

Add your answer

Q77. Have you find the location exact latlong on Google

Ans.

Yes, I have found exact latlong locations on Google.

  • Yes, I have used Google Maps to find exact latlong locations.

  • I have entered the address or name of the location in the search bar to get the latlong coordinates.

  • I have also used the 'What's here?' feature on Google Maps to get the latlong coordinates of a specific point on the map.

Add your answer

Q78. Tell me about some formulas of excel

Ans.

Excel formulas are used to perform calculations and manipulate data in spreadsheets.

  • SUM: Adds up a range of cells

  • AVERAGE: Calculates the average of a range of cells

  • VLOOKUP: Searches for a value in the first column of a table and returns a value in the same row from another column

  • IF: Performs a logical test and returns one value if the test is true and another if it's false

Add your answer

Q79. What is the cost of new marchant sound boxx rental

Add your answer

Q80. How you know about Paytm?

Ans.

Paytm is a popular Indian digital payment platform.

  • Paytm was founded in 2010 by Vijay Shekhar Sharma.

  • It offers services such as mobile recharging, bill payments, online shopping, and ticket booking.

  • Paytm has a digital wallet feature that allows users to store money and make quick payments.

  • The platform has grown to become one of the leading payment solutions in India.

Add your answer

Q81. What is company growth for?

Ans.

Company growth is for expanding market share, increasing revenue, attracting top talent, and staying competitive.

  • Expanding market share by reaching new customers and increasing sales

  • Increasing revenue through higher sales volume and new product offerings

  • Attracting top talent by showcasing a successful and growing company

  • Staying competitive in the market by adapting to changes and innovating

  • Improving brand reputation and customer loyalty

Add your answer

Q82. Guesstimate the number of credit cards in India

Ans.

There are approximately 50-60 million credit cards in circulation in India.

  • The number of credit cards in India is estimated to be around 50-60 million.

  • This number has been steadily increasing due to the rise in digital payments and e-commerce.

  • Major credit card issuers in India include HDFC Bank, SBI, ICICI Bank, and Axis Bank.

Add your answer

Q83. key difference between Business Analyst and a Data Analyst

Ans.

Business Analyst focuses on business processes and requirements, while Data Analyst focuses on analyzing data to provide insights.

  • Business Analyst focuses on understanding business processes, identifying needs, and recommending solutions.

  • Data Analyst focuses on collecting, analyzing, and interpreting data to provide insights and support decision-making.

  • Business Analyst works closely with stakeholders to gather requirements and ensure solutions meet business needs.

  • Data Analyst...read more

Add your answer

Q84. What is the sales ?

Ans.

Sales is the process of selling goods or services in exchange for money or other forms of compensation.

  • Sales involves identifying potential customers, presenting products or services to them, and closing deals.

  • It also includes building relationships with customers to encourage repeat business.

  • Sales can be done through various channels such as face-to-face interactions, phone calls, emails, and online platforms.

  • Examples of sales activities include cold calling, product demonst...read more

Add your answer

Q85. GTM for launching a loan product

Ans.

Develop a Go-To-Market strategy for launching a new loan product

  • Identify target market segments and their needs

  • Create a compelling value proposition for the loan product

  • Establish distribution channels and partnerships for reaching customers

  • Implement a marketing and advertising campaign to generate awareness and interest

  • Set up a sales team to handle customer inquiries and applications

Add your answer

Q86. What are sale in market field?

Ans.

Sales in market field refer to the process of selling goods or services to customers in exchange for money.

  • Sales involve identifying potential customers, presenting products or services, and closing deals

  • Sales can be conducted through various channels such as online, in-person, or over the phone

  • Effective sales strategies often involve building relationships with customers and understanding their needs

  • Sales performance is typically measured through metrics like revenue, conver...read more

Add your answer

Q87. Have you knowledge about excel

Ans.

Yes, I have knowledge about Excel including formulas, functions, data analysis, and creating charts.

  • Proficient in using Excel for data entry, analysis, and reporting

  • Familiar with various Excel functions such as VLOOKUP, SUMIF, and IFERROR

  • Experienced in creating pivot tables and charts for data visualization

  • Knowledgeable about advanced Excel features like macros and conditional formatting

Add your answer

Q88. Experience of dffrnt companys

Ans.

I have experience working in various companies across different industries.

  • Worked in a tech startup where I gained experience in fast-paced environment

  • Transitioned to a large corporation where I learned about corporate structure and processes

  • Spent time in a non-profit organization where I developed skills in community engagement

Add your answer

Q89. Sell me this pen ?

Ans.

This pen is not just a writing tool, it's a statement of style and sophistication.

  • This pen is made with high-quality materials that ensure a smooth writing experience.

  • The sleek design and elegant finish make it a perfect accessory for any professional setting.

  • It's refillable, so you can use it for years to come, making it a great investment.

  • The pen comes in a beautiful gift box, making it an ideal present for someone special.

  • With this pen, you'll be able to make a lasting imp...read more

Add your answer

Q90. 3 strengths and rank them

Ans.

My top strengths are strategic thinking, data analysis, and communication skills.

  • Strategic thinking: Ability to develop long-term plans and identify growth opportunities.

  • Data analysis: Proficient in analyzing data to make informed decisions and optimize strategies.

  • Communication skills: Strong ability to effectively convey ideas and collaborate with team members.

Add your answer

Q91. Previous company products

Ans.

I led the development of innovative products at my previous company, driving revenue growth and market expansion.

  • Introduced new product lines to target emerging markets

  • Implemented customer feedback to improve existing products

  • Collaborated with cross-functional teams to launch successful products

View 1 answer
Contribute & help others!
Write a review
Share interview
Contribute salary
Add office photos
Top Paytm 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

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