Tip 1 : Practice Atleast 250 Questions
Tip 2 : Do atleast 2 projects
Tip 1 : Have some projects on resume.
Tip 2 : Keep resume short
Input: 'n' = 5, 'arr' = [1, 2, 3, 4, 5]
Output: 5
Explanation: From the array {1, 2, 3, 4, 5}, the largest element is 5.
Step 1: Initialize variables maxValue and minValue with the first element of the array.
Step 2: Iterate through the array starting from the second element. Update maxValue and minValue if a larger maximum or smaller minimum value is found.
Step 3: After the loop, the maxValue and minValue variables will contain the maximum and minimum elements of the array, respectively.
String 'S' is NOT case sensitive.
Let S = “c1 O$d@eeD o1c”.
If we ignore the special characters, whitespaces and convert all uppercase letters to lowercase, we get S = “c1odeedo1c”, which is a palindrome. Hence, the given string is also a palindrome.
Step 1: Remove all non-alphanumeric characters from the string and convert it to lowercase.
Step 2: Check if the modified string is equal to its reverse.
Each pair should be sorted i.e the first value should be less than or equals to the second value.
Return the list of pairs sorted in non-decreasing order of their first value. In case if two pairs have the same first value, the pair with a smaller second value should come first.
Step 1: Create a dictionary to store the complement of each element (target minus the current element) as keys and their indices as values.
Step 2: Iterate through the array and check if the complement of the current element is in the dictionary. If found, return the indices of the two numbers.
Step 3: If no two numbers are found, return an empty list or a suitable message indicating that no solution exists
This interview held on 26 april 2023 and time was around 3 pm.
Step 1: Sort the array in ascending order to easily handle duplicates and track unique triplets.
Step 2: Iterate through the array and for each element, use two-pointer technique to find the remaining two elements that sum up to the target.
Step 3: Return the list of unique triplets that add up to the target sum.
Step 1: Define a helper function to calculate the maximum path sum for each subtree.
Step 2: Call the helper function on the root of the binary tree to calculate the maximum path sum.
Step 3: Return the maximum path sum stored in the max_sum variable.
this round was also held on 26 april 2023, and this round was around 5 pm.
Conditions for valid parentheses:
1. All open brackets must be closed by the closing brackets.
2. Open brackets must be closed in the correct order.
()()()() is a valid parentheses.
)()()( is not a valid parentheses.
In this implementation, we iterate over each character in the input string. If the character is an opening parenthesis, we push it onto the stack. If the character is a closing parenthesis, we check if the stack is empty or if the corresponding opening parenthesis matches the last opening parenthesis on the stack. If there is a match, we continue. If there is no match or the stack is empty, we return False. After iterating through the entire string, we check if there are any remaining opening parentheses on the stack. If the stack is empty, we return True; otherwise, we return False.
Can you solve this in logarithmic time and space complexity?
Step 1: When a long URL is provided, generate a unique short code for it. This code can be generated using a combination of alphanumeric characters or a hashing algorithm.
Step 2: Store the mapping between the generated short code and the original long URL in a database or key-value store.
Step 3: When a short URL is accessed, retrieve the corresponding long URL from the database using the short code and redirect the user to the original URL.
Explain the concepts of deadlock and starvation in operating systems in two lines.
Step 1: Deadlock occurs when two or more processes are unable to proceed because each is waiting for a resource held by another process.
Step 2: Starvation occurs when a process is unable to gain necessary resources to execute, often due to resource allocation policies that prioritize other processes.
This HR Round happened on next day 28th april and time was 12 pm
How do you manage your time and prioritize tasks when working on multiple projects simultaneously?
I use a project management tool to create a clear overview of all tasks and deadlines, allowing me to prioritize based on urgency and importance.
I break down larger projects into smaller, manageable tasks and allocate dedicated time slots to work on each project, ensuring progress on all fronts.
I regularly communicate with stakeholders and team members to align priorities, manage expectations, and make adjustments as needed to maintain productivity and meet project milestones.
Describe a situation where you demonstrated leadership skills or took initiative in a project or team setting.
Step 1: Context and Problem: Describe the project or team setting and the specific challenge or problem you encountered.
"In a cross-functional team working on a complex software development project, we faced a critical deadline and were falling behind due to miscommunication and lack of coordination among team members."
Step 2: Initiative and Action: Explain the leadership skills or initiative you took to address the situation.
"I recognized the need for improved collaboration and decided to take the initiative. I organized a team meeting to discuss the challenges and potential solutions. I encouraged open communication, actively listened to everyone's perspectives, and facilitated a brainstorming session to generate ideas."
Step 3: Outcome and Result: Describe the positive outcome achieved through your leadership or initiative.
"As a result of the meeting and collaborative efforts, we established a more efficient workflow, streamlined communication channels, and implemented a project management tool to track progress and deadlines. This led to improved coordination, increased productivity, and ultimately, we successfully met the critical deadline."
Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
What is the index number of the last element of an array with 9 elements?