70+ Pozitive Energy Interview Questions and Answers
Q1. Optimal BST Problem Statement
You are given a sorted array representing keys of a BST and an array of frequency counts showing how often each key is searched. Your task is to construct a binary search tree (BST...read more
Q2. Median of Two Sorted Arrays Problem Statement
Given two sorted integer arrays A
and B
with sizes N
and M
respectively, find the median of the combined array that results from merging arrays A
and B
. If the tota...read more
Q3. Determine Count of Good Triplets
You are given two arrays ARR1
and ARR2
, containing N
and M
elements respectively. There are two types of 'good triplets' that need to be identified in these arrays.
Type 1: A tr...read more
Q4. Stock Trading Maximum Profit Problem
Given the stock prices for 'N' days, your goal is to determine the maximum profit that can be achieved. You can buy and sell the stocks any number of times but can only hold...read more
Q5. Find The Repeating And Missing Number Problem Statement
You are provided with an array nums
which contains the first N positive integers. In this array, one integer appears twice, and one integer is missing. Yo...read more
Q6. Split the String Problem Statement
You are given a string str
consisting of N
lowercase alphabets. Your task is to determine if it is possible to divide the string into three non-empty substrings such that one ...read more
Q7. Optimal Strategy for a Coin Game
You are playing a coin game with your friend Ninjax. There are N
coins placed in a straight line.
Here are the rules of the game:
1. Each coin has a value associated with it.
2....read more
Q8. Counting Triangles in Graphs
Given two graphs – a directed graph DIR_GRAPH
and an undirected graph UNDIR_GRAPH
– you are tasked with counting the number of triangles in each of the graphs.
Example:
In the examp...read more
Q9. Number of Distinct Substrings Problem Statement
Given a string WORD
containing lowercase English alphabets and having length N
, determine the number of distinct substrings in WORD
.
Input:
The first line include...read more
Q10. Find Distinct Palindromic Substrings
Given a string 'S', identify and print all distinct palindromic substrings within it. A palindrome reads the same forwards and backwards. For example, 'bccb' is a palindrome...read more
Q11. Distance Between Two Nodes in a Binary Tree
Given a binary tree and the values of two distinct nodes, determine the distance between these two nodes in the tree. The distance is defined as the minimum number of...read more
Q12. Bit Majority Number Generation
You are given an array arr
consisting of N
integers. Construct a number from these integers such that, for each bit position, if the quantity of set bits (1s) is greater than the ...read more
Q13. Shuffle Two Strings
You are provided with three strings: A
, B
, and C
. Your task is to determine if C
is formed by interleaving A
and B
. A string C
is considered an interleaving of A
and B
if:
- The length of
C
i...read more
Q14. Ninja's Complement Problem Statement
Every day, Ninja dreams of a number but does not understand its significance. Upon investigation, Ninja discovers that converting this number to binary, taking its complemen...read more
Q15. Sum of Digits Problem Statement
Given an integer 'N', continue summing its digits until the result is a single-digit number. Your task is to determine the final value of 'N' after applying this operation iterat...read more
Q16. Stack with getMin Operation
Create a stack data structure that supports not only the usual push and pop operations but also getMin(), which retrieves the minimum element, all in O(1) time complexity without usi...read more
Q17. Check if Two Trees are Mirror
Given two arbitrary binary trees, your task is to determine whether these two trees are mirrors of each other.
Explanation:
Two trees are considered mirror of each other if:
- The r...read more
Q18. Count Ways to Reach the N-th Stair Problem Statement
You are provided with a number of stairs, and initially, you are located at the 0th stair. You need to reach the Nth stair, and you can climb one or two step...read more
Q19. DFS Traversal Problem Statement
Given an undirected and disconnected graph G(V, E)
, where V
is the number of vertices and E
is the number of edges, the connections between vertices are provided in the 'GRAPH' m...read more
Q20. Ninja and Sorted Array Merging Problem
Ninja is tasked with merging two given sorted integer arrays ARR1
and ARR2
of sizes 'M' and 'N', respectively, such that the merged result is a single sorted array within ...read more
Q21. Word Distance Calculation
Given a document represented as an array/list ARR
of words with length N
, find the smallest distance between two given words for multiple queries. The distance is defined as the differ...read more
Q22. Binary Tree to Doubly Linked List
Transform a given Binary Tree into a Doubly Linked List.
Ensure that the nodes in the Doubly Linked List follow the Inorder Traversal of the Binary Tree.
Input:
The first line ...read more
Q23. Validate Binary Search Tree (BST)
You are given a binary tree with 'N' integer nodes. Your task is to determine whether this binary tree is a Binary Search Tree (BST).
BST Definition:
A Binary Search Tree (BST)...read more
Q24. Snake and Ladder Problem Statement
Given a 'Snake and Ladder' board with N rows and N columns, where positions are numbered from 1 to (N*N) starting from the bottom left, alternating direction each row, find th...read more
Q25. Decode Ways Problem Statement
Given a string strNum
that represents a number, the task is to determine the number of ways to decode it using the following encoding: 'A' - 1, 'B' - 2, ..., 'Z' - 26.
Input:
The f...read more
Q26. Level Order Traversal Problem Statement
Given a binary tree of integers, return the level order traversal of the binary tree.
Input:
The first line contains an integer 'T', representing the number of test cases...read more
Q27. Longest Palindromic Subsequence Problem Statement
Given a string A
consisting of lowercase English letters, determine the length of the longest palindromic subsequence within A
.
Explanation:
- A subsequence is d...read more
Q28. Serialize and Deserialize Binary Tree Problem Statement
Given a binary tree of integers, your task is to implement serialization and deserialization methods. You can choose any algorithm for serialization and d...read more
Q29. Combination Sum Problem Statement
Given an array of distinct positive integers ARR
and a non-negative integer 'B', find all unique combinations in the array where the sum is equal to 'B'. Numbers can be chosen ...read more
Q30. Palindrome Permutation - Problem Statement
Determine if a permutation of a given string S
can form a palindrome.
Example:
Input:
string S = "aab"
Output:
"True"
Explanation:
The permutation "aba" of the string ...read more
Q31. Number of Islands Problem Statement
You are given a non-empty grid that consists of only 0s and 1s. Your task is to determine the number of islands in this grid.
An island is defined as a group of 1s (represent...read more
Q32. Generate All Parentheses Combinations
Given an integer N
, your task is to create all possible valid parentheses configurations that are well-formed using N
pairs. A sequence of parentheses is considered well-fo...read more
Q33. Difference between TOP and PS commands? why TOP is called TOP?
TOP and PS are commands used in Unix-like operating systems to display information about running processes. TOP is called TOP because it shows the top processes consuming system resources.
TOP is an interactive command that continuously updates the process list, while PS displays a snapshot of the current processes.
TOP provides real-time information about CPU usage, memory usage, and other system statistics, while PS provides a static view of the processes.
TOP allows users to ...read more
Q35. One liner command to kill all process in the system which were using JAVA?
Kill all processes using JAVA with one liner command.
Use the 'pkill' command with the '-f' option to match the process name
Combine it with the 'pgrep' command to get the process IDs of JAVA processes
Use a loop to kill each process by its ID
Q36. You are given a large array of n bits. Each bit is initially 0. You perform several operations of the type
Solution to performing operations on a large array of bits.
Use bitwise operators to perform operations on individual bits
Use a loop to iterate through the array and perform the operations
Ensure that the array is large enough to accommodate all the bits
Consider using a data structure like a bitset for efficient bit manipulation
Q37. Explain XSS attacks and how to prevent it? and the same for sqli? Any experience with them?
XSS attacks involve injecting malicious scripts into web pages, while SQLi attacks involve manipulating database queries. Prevention includes input validation and parameterized queries.
XSS attacks involve injecting malicious scripts into web pages to steal data or perform actions on behalf of the user
Prevention methods for XSS attacks include input validation, output encoding, and using Content Security Policy (CSP)
SQLi attacks involve manipulating database queries to access ...read more
Q43. How JSON(JavaScript Object Notation) works?
JSON is a lightweight data interchange format used to store and transmit data in a readable format.
JSON uses key-value pairs to represent data.
It is language-independent and easy to understand.
JSON data types include strings, numbers, booleans, arrays, and objects.
Example: {"name": "John", "age": 25}
JSON can be used with various programming languages and APIs.
Q45. what type of testings should be performed on this system?
Q48. Do you know about any software testing framework?
Yes, there are several software testing frameworks available.
Software testing frameworks provide a structured approach to testing software applications.
They offer a set of guidelines, tools, and libraries to automate and streamline the testing process.
Some popular software testing frameworks include Selenium, JUnit, TestNG, and Cucumber.
Selenium is widely used for web application testing, while JUnit and TestNG are commonly used for unit testing in Java.
Cucumber is a behavior...read more
Q49. What is the best protocol to store images?
The best protocol to store images is JPEG.
JPEG is a widely used image compression format.
It provides a good balance between image quality and file size.
JPEG supports millions of colors and is suitable for photographs and complex images.
Other protocols like PNG and GIF have their own advantages but may not be as efficient for storing images.
Q51. Tell me about mud logging work? What is viscosity and density and porosity and permiablity? And related questions in drilling and geology
Mud logging involves monitoring drilling parameters to analyze rock formations. Viscosity, density, porosity, and permeability are key properties in drilling and geology.
Mud logging involves analyzing drilling cuttings and fluids to determine rock properties and detect hydrocarbons.
Viscosity refers to a fluid's resistance to flow, important for maintaining drilling mud circulation.
Density is the mass per unit volume of a substance, crucial for balancing well pressure.
Porosity...read more
Q52. Given n stairs , you climb 1 , 2 or 3 stairs at a time . Find the number of ways to reach the nth step
Q53. Given a boolean expression find the number of ways to paranthasise it so that it evaluates to true
The number of ways to parenthesize a boolean expression to evaluate to true can be found using dynamic programming.
Use dynamic programming to count the number of ways to parenthesize the expression.
Consider all possible ways to split the expression into subexpressions.
Keep track of the number of ways each subexpression can evaluate to true.
Combine the results of subexpressions to get the total number of ways to parenthesize the expression to true.
Q54. Design a complete system for “Traffic enforcement camera” (-----Traffic_enforcement_camera)
Q55. Experiences with automated and manual testings ?
Automated testing involves using software tools to execute tests, while manual testing is performed by humans.
Automated testing is faster and more efficient than manual testing.
Automated testing can be used to perform repetitive tasks and regression testing.
Manual testing allows for exploratory testing and human judgment.
Automated testing requires initial setup and maintenance of test scripts.
Both types of testing have their own advantages and disadvantages.
Q56. What is the difference in checked and unchecked exceptions ?
Checked exceptions are checked at compile time while unchecked exceptions are not checked at compile time.
Checked exceptions are subclasses of Exception class except RuntimeException and its subclasses.
Unchecked exceptions are subclasses of RuntimeException and Error classes.
Checked exceptions must be caught or declared in the method signature using 'throws' keyword.
Unchecked exceptions do not need to be caught or declared.
Examples of checked exceptions include IOException, C...read more
Q57. which database to use and when ?
Q58. Find the min difference between any two integers of 2 sorted list
To find the minimum difference between any two integers of 2 sorted lists, iterate through both lists simultaneously and keep track of the minimum difference.
Iterate through both sorted lists simultaneously
Keep track of the minimum difference found so far
Update the minimum difference if a smaller difference is found
Q59. How to Improve production, quality
Improving production and quality requires a focus on process optimization, employee training, and continuous improvement initiatives.
Implement lean manufacturing principles to streamline processes and reduce waste
Invest in employee training and development to improve skills and knowledge
Establish quality control measures and regularly monitor performance
Encourage employee feedback and suggestions for improvement
Regularly review and update production processes to ensure effici...read more
Q60. Given a binary tree, do right rotation on each node.
Perform right rotation on each node of a binary tree.
Start from the root node and perform right rotation on each node in a recursive manner.
Update the parent-child relationships accordingly after each rotation.
Ensure that the binary tree structure is maintained throughout the process.
Q61. What is trust and safety
Trust and safety refers to the measures taken to ensure the safety and security of users on a platform or service.
It involves implementing policies and procedures to prevent harmful behavior such as fraud, harassment, and hate speech.
Trust and safety also includes measures to protect user data and privacy.
Examples of trust and safety measures include account verification, content moderation, and user reporting systems.
Trust and safety specialists work to maintain a safe and t...read more
Q62. What is ACID in DBs ?
ACID stands for Atomicity, Consistency, Isolation, and Durability in databases.
Atomicity ensures that all operations in a transaction are completed successfully or none at all.
Consistency ensures that the database remains in a consistent state before and after the transaction.
Isolation ensures that multiple transactions can be executed concurrently without affecting each other.
Durability ensures that once a transaction is committed, it will persist even in the event of system...read more
Q63. What is risk management
Risk management is the process of identifying, assessing, and prioritizing potential risks and taking measures to minimize or mitigate them.
Identifying potential risks
Assessing the likelihood and impact of each risk
Prioritizing risks based on their severity
Developing strategies to minimize or mitigate risks
Monitoring and reviewing risks regularly
Examples include financial risk management, cybersecurity risk management, and health and safety risk management
Q64. what is your sales philosophy
My sales philosophy is centered around building strong relationships, providing value, and always putting the client's needs first.
Focus on building trust and rapport with clients
Understand the client's needs and provide tailored solutions
Always prioritize the client's best interests
Consistently follow up and provide excellent customer service
Strive to exceed client expectations
Q65. Sort a stack using a stack
Sort a stack using another stack
Create an empty temporary stack
Pop elements from the original stack and push them onto the temporary stack in sorted order
Pop elements from the temporary stack back to the original stack
Q66. Find the leaves of the tree.
Leaves of a tree are the nodes with no children in a tree data structure.
Traverse the tree and identify nodes with no children.
Use depth-first search or breadth-first search algorithms to find leaves.
Examples: In a binary tree, leaves are nodes with no left or right child.
In a general tree, leaves are nodes with no children in their child list.
Q67. Windows function in sql
The Windows function in SQL is used to perform calculations on a specific subset of rows in a result set.
The Windows function is used with the OVER clause to define the subset of rows to perform calculations on.
Common Windows functions include ROW_NUMBER, RANK, DENSE_RANK, and NTILE.
Example: SELECT ROW_NUMBER() OVER (PARTITION BY department ORDER BY salary DESC) AS row_num FROM employees;
Q68. dsa competitive coding too tough
Competitive coding can be tough but with practice and dedication, it can be mastered.
Practice regularly to improve problem-solving skills
Understand different data structures and algorithms
Participate in coding competitions to test and improve skills
Q69. Find the LCA of tree.
The Lowest Common Ancestor (LCA) of a tree is the shared ancestor of two nodes farthest from the root.
Start from the root and traverse the tree to find the paths from the root to the two nodes.
Compare the paths to find the last common node between them, which is the LCA.
If one of the nodes is an ancestor of the other, then the ancestor node is the LCA.
Q70. Design a monitoring system
Design a monitoring system for SiteOps
Identify key metrics to monitor such as server uptime, response time, and error rates
Implement monitoring tools like Nagios, Zabbix, or Prometheus to track these metrics
Set up alerts for critical thresholds to notify the team in case of issues
Create dashboards to visualize the data and trends for easy monitoring
Regularly review and update the monitoring system to ensure it remains effective
Q71. Examples of automation
Automation in SiteOps involves using tools and scripts to streamline processes and reduce manual tasks.
Automated deployment scripts for deploying code changes to servers
Monitoring tools that automatically alert when server resources are low
Automated backup processes for data protection
Scheduled tasks for routine maintenance like database cleanup
Q72. Prioritise multiple tasks
Prioritizing multiple tasks involves assessing urgency, importance, and deadlines to determine the order of completion.
Evaluate the urgency and importance of each task
Consider deadlines and time constraints
Use tools like to-do lists or project management software to organize tasks
Communicate with stakeholders to clarify priorities
Adjust priorities as needed based on changing circumstances
Top HR Questions asked in Pozitive Energy
Interview Process at Pozitive Energy
Top Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month