Paytm
50+ Dattson & Co Interview Questions and Answers
Given a singly linked list of integers. Your task is to return the head of the reversed linked list.
For example:
The given linked list is 1 -> 2 -> 3 -> 4-> NULL. Then the reverse linked lis...read more
Given an array of numbers, find the maximum sum of any contiguous subarray of the array.
For example, given the array [34, -50, 42, 14, -5, 86], the maximum sum would be 137, since we would ...read more
You have been given a grid containing some oranges. Each cell of this grid has one of the three integers values:
You have been given a linked list of integers. Your task is to write a function that deletes a node from a given position, 'POS'.
Note :
Assume that the Indexing for the linked lis...read more
Given a linked list having two pointers in each node. The first one points to the next node of the list, however, the other pointer is random and can point to any node of th...read more
You are given an array of integers. You need to sort the array in ascending order using quick sort.
Quick sort is a divide and conquer algorithm in which we choose a pivot point and partition the arr...read more
You have been given a binary tree of 'N' nodes. Print the Spiral Order traversal of this binary tree.
For example
For the given binary tree [1, 2, 3, -1, -1, 4, 5, -1, -1,...read more
A palindrome string is one that reads the same backward as well as forward. Given a string 'STR', you need to tell the minimum number of characters needed to insert...read more
You have been given a Binary Tree of 'N' nodes, where the nodes have integer values. Your task is to print the zigzag traversal of the given tree.
Note:
In zigzag order, level 1 is printed from...read more
You have been given two Strings “STR1” and “STR2” of characters. Your task is to find the length of the longest common subsequence.
A String ‘a’ is a subsequence of a String ‘b’ if ‘a’...read more
There is a one-dimensional garden of length 'N'. On each of the positions from 0 to 'N', there is a fountain, and this fountain’s water can reach up to a certain range as explained further. In ...read more
You have been given an array/list ARR consisting of ‘N’ elements. Each element in the array is either 0, 1 or 2.
Now, your task is to sort this array/list in increasing order. For ...read more
You are given a Singly Linked List of integers and a reference to the node to be deleted. Every node of the Linked List has a unique value written on it. Your task is to delete that ...read more
For a given array/list of integers of size N, print the Next Greater Element(NGE) for every element. The Next Greater Element for an element X is the first element on the right side of X in ...read more
You have been given an array/list of strings 'STR_LIST'. You are supposed to return the strings as groups of anagrams such that strings belonging to a particular group are anagrams of one...read more
You have been given an arbitrary binary tree and a node of this tree. You need to find the inorder successor of this node in the tree.
The inorder successor of a node in a binary tree is that no...read more
Given a ‘N’ * ’M’ maze with obstacles, count and return the number of paths to reach the right-bottom cell from the top-left cell. A cell in the given maze has a value -1 if it is a blockage or de...read more
You have been given a singly Linked List of integers. Your task is to delete the middle node of this List.
Note:
1. If there is no middle node in the list to delete, return an empty list (i.e...read more
You have been given two singly Linked Lists, where each of them represents a positive number without any leading zeros.
Your task is to add these two numbers and print the summation in the ...read more
Given a sequence of numbers ‘ARR’. Your task is to return a sorted sequence of ‘ARR’ in non-descending order with help of the merge sort algorithm.
Example :
Merge Sort Algorithm - Merge sort is a Di...read more
You are given an array of integers 'ARR' of length 'N' and an integer Target. Your task is to return all pairs of elements such that they add up to Target.
Note:
We cannot use the element at a given ind...read more
You are given an array 'ARR' consisting of 'N' positive numbers and sorted in non-decreasing order, and your task is to find the smallest positive integer value that cannot be represented a...read more
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
You are given a N x 2 2-D array 'Jobs' of 'N' jobs where Jobs[i][0] denote the deadline of i-th job and Jobs[i][1] denotes the profit associated with i-th job.
You will make a certain prof...read more
Ninja is stuck in a maze which is in a form of a binary tree. He needs your help in order to get out.
Ninja is presently at the node ‘X’. The only exit points of the maz...read more
You have been given two arrays, 'AT' and 'DT', representing the arrival and departure times of all trains that reach a railway station.
Your task is to find the minimum numbe...read more
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
Given a binary tree. Your task is to print the bottom right view of the binary tree.
Bottom right view, on viewing the given binary tree at the angle of 45 degrees from the botto...read more
You are given a list of ‘transactions’ between ‘n’ number of friends. who have to give each other money. The list consists of data of receiver, sender, and transaction.
Your task is to minimiz...read more
You are 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’ in array ‘A’ is the largest element in the array ...read more
Given a sequence of ‘N’ space-separated non-negative integers A[1],A[2],A[3],......A[i]…...A[n]. Where each number of the sequence represents the height of the line drawn at point 'i'. ...read more
You have been given an array/list ARR consisting of ‘N’ integers. You are also given a positive integer ‘K’.
Your task is to find the lexicographically smallest ARR that can be o...read more
Given an array ARR of N integers and an integer S. The task is to find whether there exists a subarray(positive length) of the given array such that the sum of elements of the subar...read more
A person has 3000 bananas and a camel. He wants to transport the maximum number of bananas to a destination 1000 KMs away, using only the camel as a mode of transportation. The camel cann...read more
Introduction of all my projects.
What is serialization and deserialization in Java?
Deep go through all the projects and technology used in projects Challenges you have faced and how did...read more
• Flow kotlin
• Android 10 to Android 11 migration support
• Kotlin cons and pros
• Dagger! should we use it?
• MVVM explain
• Android versions with their features and specialities
• Activity...read more
Multithreading Concepts? How thread works in java?
Difference in sleep() and wait().
Print even odd using two threads. What is synchronization Block & why it is used?
He asked me some output questions which were based on JavaScript fundamentals like hoisting, arrow function etc.
Some questions were from Redux. At that time I didn't have any experien...read more
Q37. Write a function that returns '3' when '4' is passed as an input and vice versa without using if-else condition
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
Q38. A 2D matrix is given which is row wise and column wise sorted. Find a particular element from it
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
Given a binary tree (not a binary search tree) and two values say n1 and n2, write a program to find the least common ancestor.
Main questions that were asked were based on callbacks, promises, Closures, Event loop.
Some output guessing questions :
1. Difference between let, var, const
2. ES6 features
3. Hoisting
4. Rest,...read more
Q41. Find the odd repeating element from a set of repeating elements
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
Questions about scheduling algorithms, dead lock, synchronization etc. were asked.
Q43. design dictionary using trie....having operations of inserting a word, updating and deleting (needed to write full running code)
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
He asked me some JavaScript questions again and also told me about the work culture of his team. It was more like an open discussion with some tech questions
Q45. Given a graph, print all the connected components in it.
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.
Q46. SQL Query to find Nth highest salary from table
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
Q48. Puzzle on measuring exactly half a glass of water
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
Q49. Write a program to find Minimum length of string in 'bdcabdcbaabbbac' containing substring 'abc'
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.
Q50. Write a program to Create a spiral array using 2D-array
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
Q51. Types of DS and a real life scenario.
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
Q52. OOPs in python and explain them
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.
Q53. Build Basic LRU without Libraries
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
Top HR Questions asked in Dattson & Co
Interview Process at Dattson & Co
Top Software Developer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month