Tip 1: Strengthen Core Concepts – Focus on programming, data structures, and algorithms.
Tip 2: Practice Aptitude – Sharpen your quantitative, logical reasoning, and verbal skills.
Tip 3: Highlight Problem-Solving – Clearly explain your approach in interviews and showcase your projects.
Tip 1: Keep It Concise – Limit your resume to one page with clear, readable formatting.
Tip 2: Tailor for the Role – Customize your resume to match the job description and emphasize the required skills.
Focused on aptitude, logical reasoning, verbal ability, and basic technical concepts (C, OOPs, DBMS). Coding Round: Involved writing or debugging code (in C, C++, Java, or Python) with questions on data structures and algorithms.
Problem: Find the Missing Number
You are given an array of n-1 integers, all ranging from 1 to n. The array contains unique numbers, but one number between 1 and n is missing. Your task is to find the missing number.
Input:
An array arr[] of length n-1 where 1 ≤ arr[i] ≤ n.
The size of the array is n-1.
Output:
Return the missing number.
Sum Formula Approach: I calculated the sum of numbers from 1 to n using the formula -: n * (n + 1) / 2
and subtracted the sum of the array elements to find the missing number.
XOR Approach: To optimize, I used XOR. XORed all numbers from 1 to n and XORed all elements in the array. The result will be the missing number because all other numbers cancel out.
Final Solution: The XOR approach is efficient with a time complexity of O(n) and a space complexity of O(1).
Find the Largest Sum of Contiguous Subarray (Kadane's Algorithm)
You are given an array of integers. Your task is to find the contiguous subarray (containing at least one number) which has the largest sum.
Input:
An array arr[] of n integers.
Output:
Return the largest sum of the contiguous subarray.
Initial Approach (Brute Force): I initially thought of sorting the array to find the missing number, but I realized it would take O(n log n) time, which was inefficient.
Optimized Approach (Sum Formula): I used the sum formula for numbers 1 to n and subtracted the sum of the array from it. This gave the missing number in O(n) time but still required extra space.
Further Optimization (XOR): The interviewer asked me to optimize further, so I used XOR to find the missing number in O(n) time and O(1) space.
Result: The XOR-based solution was efficient, and the solution was selected due to its optimization.
You are in a room with two doors. One door leads to freedom, and the other leads to certain doom. There are two guards: one always tells the truth, and the other always lies. You don’t know which guard is which. You can ask one guard a single question to determine which door leads to freedom. What question would you ask?
Tip 1: Break down the problem: Understand the details, identify key elements, and simplify it into smaller steps.
Tip 2: Use logical thinking: Apply deduction, eliminate options, and think creatively or backward when needed.
Tip 3: Visualize and practice: Draw diagrams if necessary, and practice regularly to improve problem-solving skills.
You are standing in a room with three light switches. Each switch controls one of three light bulbs in the next room. You can’t see the bulbs from where you are. You may flip the switches as many times as you want, but you can only enter the room with the bulbs once. How can you determine which switch controls which bulb?
Tip 1: Break down the problem: Understand the details, identify key elements, and simplify it into smaller steps.
Tip 2: Use logical thinking: Apply deduction, eliminate options, and think creatively or backward if necessary.
Tip 3: Visualize and practice: Draw diagrams if needed, and practice regularly to improve problem-solving skills.
Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
How do you select an element by class name in CSS?