We have been asked to return the integer that has been repeated. There could only be one number that has been repeated and only once. In an array of length n+1, the elements are in the range [1, n]. They have specified that the original array shoul...
We have been asked to return an integer array such that it has elements in respective indices of a given integer array which are products of all the other elements except itself. I.e., the array to be returned (say) output has elements such that, out...
What we are trying to solve? Let’s say we have an array, we have to find out the subarray such that the sum of the elements in that subarray is maximum & we have to return its sum. So, what are the possible ways we can solve this? Brute Force - We c...
📚 Problem Overview In Vertical Order Traversal of a Binary Tree, we need to: Print nodes column-wise from left to right. Sort nodes in each column top to bottom. If two nodes share the same position, sort their values in ascending order. 💡 Th...
What is time complexity ? Time complexity is time taken by the code or algorithm to execute the program. Time complexity depends on the size of the input. There are three notations in time complexity : Best Case ( Ω )Average Case ( Θ )Worst Case ( O ...
Problem Statement:You are given an array: arr = {10, 20, 30, 40, 50}; And the following queries: Add 5 to every element in the interval [1, 3] Add 10 to every element in the interval [2, 4] What should the final array look like after all these ...
"Bro, why are we even learning sorting when we have sort()?"— Me, a few months ago Hey everyone! 👋 I'm Ritam (or just a random 19-year-old trying to survive C++), and today we’re talking about something that sounds boring but is actually weirdly sa...
Introduction: Welcome to Day 9 of my 90 Days DSA Challenge! Today, I focused on refining recursive logic and enhancing validation techniques. I tackled two essential binary tree problems using recursion and revisited the classic Valid Sudoku problem....
🔥 Introduction: Welcome back to Day 8 of my 90 Days DSA Challenge!Today, I dove deep into the recursive world of binary trees, where every call is a path and every return is a revelation. We explored three essential problems that form the foundation...
Welcome back, tech enthusiasts! On Day 7 of the 90 Days DSA Challenge, I explored a mix of Binary Tree Traversals and a String pattern search problem, and revised two previously covered Linked List problems. This blend of problems gave me a chance to...