Skip to main content

Posts

Showing posts with the label Interview Questions

Learn how to improve communication as an IT fresher with practical tips for meetings, managers, seniors, English, updates, blockers, and workplace messages.

How to Improve Communication as an IT Fresher You can be good at Java, Python, React, SQL, testing, or whatever technology your project uses and still feel completely lost when someone says, “Can you explain what you did?” This is especially common when you are an IT fresher. You may know the answer in your head, but the moment you have to speak in a meeting, talk to a senior developer, ask your manager a question, or explain a technical problem in English, you suddenly start overthinking every sentence. If this sounds familiar, you are not alone. And you do not need perfect English, a foreign accent, or an impressive vocabulary to communicate well at work. Good workplace communication is much simpler: be clear, concise, respectful, honest, and easy to understand. The good news is that communication is a skill you can improve through everyday work. You do not have to become a completely different person. You simply need to become better at explaining what you know, asking wha...

33. Search in Rotated Sorted Array

33. Search in Rotated Sorted Array LeetCode 33 – Search in Rotated Sorted Array is a classic binary search problem. The important part is not simply finding the target, but finding it in O(log n) time even though the sorted array has been rotated. The key observation is that, at any point during binary search, at least one half of the current search range will always be sorted . 📄 Problem Statement You are given an integer array nums that was originally sorted in ascending order. All elements are distinct. The array may have been rotated around an unknown pivot. For example: Original: [0,1,2,4,5,6,7] Rotated: [4,5,6,7,0,1,2] You are also given an integer target . Return the index of target if it exists in the array. Otherwise, return -1 . The solution must run in: O(log n) time. 📚 Examples Example 1: Input: nums = [4,5,6,7,0,1,2] target = 0 Output: 4 The target 0 is present at index 4 . Example 2: Input: nums = [4,5,6,7,0,1,2] target = 3 O...

53. Maximum Subarray | Kadane’s Algorithm

53. Maximum Subarray  Medium Topics: Array, Dynamic Programming 💬 Problem Statement: Given an integer array nums , find the subarray with the largest sum , and return its sum. 🧪 Examples: Example 1: Input: nums = [-2,1,-3,4,-1,2,1,-5,4] Output: 6 Explanation: The subarray [4,-1,2,1] has the largest sum 6. Example 2: Input: nums = [1] Output: 1 Explanation: The subarray [1] has the largest sum 1. Example 3: Input: nums = [5,4,-1,7,8] Output: 23 Explanation: The subarray [5,4,-1,7,8] has the largest sum 23. 🔒 Constraints: 1 <= nums.length <= 10⁵ -10⁴ <= nums[i] <= 10⁴ 🧠 Approach 1: Kadane's Algorithm (O(n) Time) Kadane’s Algorithm helps you find the maximum sum of a contiguous subarray in just one pass. 👉 Intuition: We move through the array and: Keep adding elements to a running sum ( maxEndingHere ) If maxEndingHere becomes negative, we reset it to 0 Track the maximum seen so far in maxSoFar   MY solution, 🪄 Java Code:   ...