Tanisha Gupta on LinkedIn: #codingchallenge #trappingrainwater #algorithmdesign #50daysofcode (2024)

Tanisha Gupta

Learner || JAVA|| C || HTML|| CSS|| JAVASCRIPT || PYTHON

  • Report this post

🌟 Day 25/50: Trapping Rain Water 🌧️Hello, Connections!Today marks Day 25 of my 50-day challenge, and I’m diving into an intriguing problem: Trapping Rain Water.Problem Statement: Given an array of non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it can trap after raining.Algorithm Overview: To solve this problem efficiently, I’ve implemented an algorithm with a time complexity of O(N) and a space complexity of O(N).Approach:Initialize Arrays: Create two arrays, left_max and right_max, to store the maximum heights to the left and right of each element.Compute Left Max Array: Traverse the array from left to right, filling left_max such that each element at index i contains the maximum height encountered so far from the left.Compute Right Max Array: Traverse the array from right to left, filling right_max such that each element at index i contains the maximum height encountered so far from the right.Calculate Trapped Water: For each element in the array, calculate the water trapped at that index by taking the minimum of left_max[i] and right_max[i], subtracting the height at that index, and summing up the results.This efficient solution leverages pre-computed information to ensure we only pass through the array a few times, maintaining linear time complexity.🔗 #CodingChallenge #TrappingRainWater #AlgorithmDesign #50DaysOfCode

  • Tanisha Gupta on LinkedIn: #codingchallenge #trappingrainwater #algorithmdesign #50daysofcode (2)
  • Tanisha Gupta on LinkedIn: #codingchallenge #trappingrainwater #algorithmdesign #50daysofcode (3)
  • Tanisha Gupta on LinkedIn: #codingchallenge #trappingrainwater #algorithmdesign #50daysofcode (4)

9

1 Comment

Like Comment

Creds

2h

  • Report this comment

Congratulations, Tanisha Gupta! This accomplishment is truly exceptional! Keep moving forward, and we're here to provide support and celebrate your success! 👏🎉

Like Reply

1Reaction

To view or add a comment, sign in

More Relevant Posts

  • Tanisha Gupta

    Learner || JAVA|| C || HTML|| CSS|| JAVASCRIPT || PYTHON

    • Report this post

    Hello Connections! 👋Day 24/50: Best Time to Buy and Sell Stock IIToday's challenge focuses on maximizing profits from stock prices over a series of days. The key is to identify the best times to buy and sell stocks to achieve the highest possible profit.Problem Statement:Given an array of prices where each element represents the price of a stock on a given day, our task is to determine the maximum profit we can achieve through multiple transactions (buying and selling stocks on different days).Example:Input: prices = [7, 1, 5, 3, 6, 4]Output: 7Explanation:Buy on day 2 (price = 1) and sell on day 3 (price = 5) for a profit of 5 - 1 = 4.Buy on day 4 (price = 3) and sell on day 5 (price = 6) for a profit of 6 - 3 = 3.Total Profit: 4 + 3 = 7Algorithm:Initialize Profit: Set total profit to 0.Iterate Through Prices: Loop through the prices array from the second day onward.Check Price Increase: If the price on a given day is higher than the previous day, calculate the difference and add it to the total profit.Continue to Next Day: Repeat this for the entire array to accumulate the total profit.Output Result: Return the total calculated profit.Complexity:Time Complexity: O(N), where N is the number of days.Space Complexity: O(1), as we're using a constant amount of extra space.This approach ensures that we capture all upward trends in prices, maximizing our gains efficiently.Excited to continue the journey of learning and growing with these daily challenges! 🚀#CodingChallenge #Day23 #StockTrading #Algorithm #ProblemSolving #TechLearning

    • Tanisha Gupta on LinkedIn: #codingchallenge #trappingrainwater #algorithmdesign #50daysofcode (9)
    • Tanisha Gupta on LinkedIn: #codingchallenge #trappingrainwater #algorithmdesign #50daysofcode (10)

    12

    Like Comment

    To view or add a comment, sign in

  • Tanisha Gupta

    Learner || JAVA|| C || HTML|| CSS|| JAVASCRIPT || PYTHON

    • Report this post

    Hello, Connections!Day 23/50: Subarray Sum Equals KToday’s challenge is to find the number of continuous subarrays within a given array whose sum equals a target value, k. This problem is an excellent exercise in using hash maps to optimize for time complexity.Approach:Time Complexity: O(N)Space Complexity: O(N)Solution Overview: To solve this problem efficiently, we utilize a hash map to store the cumulative sum up to each index. By checking the difference between the current cumulative sum and the target sum k, we can determine if there is a subarray that meets the condition. This approach allows us to avoid the naive O(N^2) solution, significantly improving performance.#java #problemsolving #50daysChallenge

    • Tanisha Gupta on LinkedIn: #codingchallenge #trappingrainwater #algorithmdesign #50daysofcode (13)
    • Tanisha Gupta on LinkedIn: #codingchallenge #trappingrainwater #algorithmdesign #50daysofcode (14)

    12

    Like Comment

    To view or add a comment, sign in

  • Tanisha Gupta

    Learner || JAVA|| C || HTML|| CSS|| JAVASCRIPT || PYTHON

    • Report this post

    Hello Connections!Day 22/50 of my coding challenge is here, and today’s task is all about finding the leaders in an array! 🚀A leader in an array is an element that is greater than all the elements to its right. The goal is to find all such leaders in a given array with a time complexity of O(n).Approach:Start from the End:Traverse the array from right to left, starting with the last element, which is always a leader.Keep Track of Maximum:Maintain a variable to keep track of the maximum element found so far as you move from right to left.Compare and Collect Leaders:For each element, compare it with the current maximum.If the element is greater than the maximum, it is a leader, and update the maximum to this element.Continue this process until the beginning of the array is reachedThis problem not only highlights the importance of optimizing for time complexity but also showcases the elegance of linear scanning techniques. #coding #problemSolving #arrayLeaders #50DaysChallenge #Day22

    • Tanisha Gupta on LinkedIn: #codingchallenge #trappingrainwater #algorithmdesign #50daysofcode (17)
    • Tanisha Gupta on LinkedIn: #codingchallenge #trappingrainwater #algorithmdesign #50daysofcode (18)

    15

    Like Comment

    To view or add a comment, sign in

  • Tanisha Gupta

    Learner || JAVA|| C || HTML|| CSS|| JAVASCRIPT || PYTHON

    • Report this post

    Hello Connections!!🔹 Day 21 of My 50-Day Coding Challenge 🔹Problem: Rotate an array by k stepsInput: nums = [1, 2, 3, 4, 5, 6, 7], k = 3Output: [5, 6, 7, 1, 2, 3, 4]Explanation:1 If k is greater than the array length, compute k = k % n to handle cases where k exceeds the length of the array.2 First rev the array from 0 to n-k-1 then rev the array from n-k to n-1 then rev the array from 0 to n-13 then check if i<jswap (arr[i],arr[j])i++;j--;Complexity:Time Complexity: O(2N)Space Complexity: O(1) This approach leverages the power of array reversal to achieve the desired rotation with minimal space usage, demonstrating how optimizing basic operations can lead to efficientsolution

    • Tanisha Gupta on LinkedIn: #codingchallenge #trappingrainwater #algorithmdesign #50daysofcode (22)
    • Tanisha Gupta on LinkedIn: #codingchallenge #trappingrainwater #algorithmdesign #50daysofcode (23)

    19

    To view or add a comment, sign in

  • Tanisha Gupta

    Learner || JAVA|| C || HTML|| CSS|| JAVASCRIPT || PYTHON

    • Report this post

    🚀 Day 20/50: Solving the "Max Consecutive Ones" Problem! 🚀Hello everyone! Today marks Day 20 of my 50-day coding challenge. 🎉Problem Statement:Given a binary array, find the maximum number of consecutive 1s.Input: nums = [1,1,0,1,1,1]Output: 3Constraints:Time Complexity: O(n)Space Complexity: O(1)This approach efficiently finds the longest sequence of consecutive 1s with linear time complexity and constant space complexity, showcasing the power of simple yet effective algorithms.Looking forward to Day 21! Thanks for following along. 🌟#50DaysOfCode #CodingChallenge #Algorithm #java #LinkedInLearning

    • Tanisha Gupta on LinkedIn: #codingchallenge #trappingrainwater #algorithmdesign #50daysofcode (26)
    • Tanisha Gupta on LinkedIn: #codingchallenge #trappingrainwater #algorithmdesign #50daysofcode (27)
    • Tanisha Gupta on LinkedIn: #codingchallenge #trappingrainwater #algorithmdesign #50daysofcode (28)

    14

    Like Comment

    To view or add a comment, sign in

  • Tanisha Gupta

    Learner || JAVA|| C || HTML|| CSS|| JAVASCRIPT || PYTHON

    • Report this post

    Hello Everyone!!Day 19 of my 50-day challenge!Today's problem: Majority ElementInput: nums = [3,2,3]Output: 3Constraints:Time Complexity: O(n log n)Space Complexity: O(1)Stay tuned for my solution!#CodingChallenge #Day19 #Algorithms #ProblemSolving #DataStructures

    • Tanisha Gupta on LinkedIn: #codingchallenge #trappingrainwater #algorithmdesign #50daysofcode (31)
    • Tanisha Gupta on LinkedIn: #codingchallenge #trappingrainwater #algorithmdesign #50daysofcode (32)

    12

    2 Comments

    Like Comment

    To view or add a comment, sign in

  • Tanisha Gupta

    Learner || JAVA|| C || HTML|| CSS|| JAVASCRIPT || PYTHON

    • Report this post

    Hello Everyone!!Day 18/50Problem: Binary SearchTime Complexity: O(log N)Space Complexity: O(1)#50DayChallenge #Coding #BinarySearch #Algorithms #TechJourney

    • Tanisha Gupta on LinkedIn: #codingchallenge #trappingrainwater #algorithmdesign #50daysofcode (35)
    • Tanisha Gupta on LinkedIn: #codingchallenge #trappingrainwater #algorithmdesign #50daysofcode (36)

    11

    Like Comment

    To view or add a comment, sign in

  • Tanisha Gupta

    Learner || JAVA|| C || HTML|| CSS|| JAVASCRIPT || PYTHON

    • Report this post

    Hey connections 🌟 I am thrilled to share that I've been offered an internship opportunity at CodSoft where I will be delving into Java Programming! 🚀This internship represents a pivotal moment in my career journey, offering a platform to apply my passion for coding in a professional setting. I am eager to immerse myself in the world of Java, sharpening my skills and gaining hands-on experience under the guidance of CodSoft's talented team.I am grateful for this opportunity and determined to make the most of it. Stay tuned as I embark on this enriching journey with CodSoft! 🌐#Internship #JavaProgramming #Codsoft #CareerDevelopment #SoftwareEngineering #LearningAndDevelopment #TechInnovation #ExcitingTimesAhead

    • Tanisha Gupta on LinkedIn: #codingchallenge #trappingrainwater #algorithmdesign #50daysofcode (39)

    14

    1 Comment

    Like Comment

    To view or add a comment, sign in

  • Tanisha Gupta

    Learner || JAVA|| C || HTML|| CSS|| JAVASCRIPT || PYTHON

    • Report this post

    🚀 Day 17/50: Best Time to Buy and Sell Stock 🚀Today's challenge was to solve the classic "Best Time to Buy and Sell Stock" problem. The goal is to maximize profit by choosing a single day to buy and a different day in the future to sell.🔍 Problem Statement:Given an array of prices where prices[i] is the price of a given stock on the i-th day, find the maximum profit you can achieve. You may only complete one transaction: buy one and sell one share of the stock.💡 Example:Input: prices = [7,1,5,3,6,4]Output: 5(Explanation: Buy on day 2 (price = 1) and sell on day 5 (price = 6), profit = 6-1 = 5)📊 Time Complexity: O(N)📦 Space Complexity: O(1)The solution involves iterating through the list while keeping track of the minimum price encountered so far and the maximum profit possible.#50DaysChallenge #Coding #ProblemSolving #Algorithm #TechJourney

    • Tanisha Gupta on LinkedIn: #codingchallenge #trappingrainwater #algorithmdesign #50daysofcode (42)
    • Tanisha Gupta on LinkedIn: #codingchallenge #trappingrainwater #algorithmdesign #50daysofcode (43)
    • Tanisha Gupta on LinkedIn: #codingchallenge #trappingrainwater #algorithmdesign #50daysofcode (44)

    13

    Like Comment

    To view or add a comment, sign in

Tanisha Gupta on LinkedIn: #codingchallenge #trappingrainwater #algorithmdesign #50daysofcode (47)

Tanisha Gupta on LinkedIn: #codingchallenge #trappingrainwater #algorithmdesign #50daysofcode (48)

366 followers

  • 28 Posts

View Profile

Follow

Explore topics

  • Sales
  • Marketing
  • Business Administration
  • HR Management
  • Content Management
  • Engineering
  • Soft Skills
  • See All
Tanisha Gupta on LinkedIn: #codingchallenge #trappingrainwater #algorithmdesign #50daysofcode (2024)

References

Top Articles
Monster Hunter Rise Sunbreak Charge Blade Builds
Sunbreak | Dual Blades Best Builds | Monster Hunter Rise - GameWith
Is Paige Vanzant Related To Ronnie Van Zant
What to Do For Dog Upset Stomach
Identifont Upload
Seething Storm 5E
Words From Cactusi
Pike County Buy Sale And Trade
Www Thechristhospital Billpay
Call of Duty: NEXT Event Intel, How to Watch, and Tune In Rewards
Culvers Tartar Sauce
Programmieren (kinder)leicht gemacht – mit Scratch! - fobizz
4156303136
Bad Moms 123Movies
Craigslist Farm And Garden Tallahassee Florida
Char-Em Isd
Craiglist Kpr
Destiny 2 Salvage Activity (How to Complete, Rewards & Mission)
Nine Perfect Strangers (Miniserie, 2021)
Foxy Brown 2025
Halo Worth Animal Jam
Qhc Learning
Free Personals Like Craigslist Nh
Craigslist Northfield Vt
[PDF] NAVY RESERVE PERSONNEL MANUAL - Free Download PDF
What Is The Lineup For Nascar Race Today
Understanding Gestalt Principles: Definition and Examples
Margaret Shelton Jeopardy Age
27 Modern Dining Room Ideas You'll Want to Try ASAP
1773x / >
Cal State Fullerton Titan Online
Cfv Mychart
manhattan cars & trucks - by owner - craigslist
Have you seen this child? Caroline Victoria Teague
How to Get Into UCLA: Admissions Stats + Tips
Colorado Parks And Wildlife Reissue List
Marie Peppers Chronic Care Management
Craigslist Georgia Homes For Sale By Owner
9781644854013
Aliciabibs
Claim loopt uit op pr-drama voor Hohenzollern
Atlanta Musicians Craigslist
Shuaiby Kill Twitter
Worcester County Circuit Court
21 Alive Weather Team
3367164101
Nurses May Be Entitled to Overtime Despite Yearly Salary
Zadruga Elita 7 Live - Zadruga Elita 8 Uživo HD Emitirani Sat Putem Interneta
Gummy Bear Hoco Proposal
Tanger Outlets Sevierville Directory Map
Maurices Thanks Crossword Clue
Ravenna Greataxe
Latest Posts
Article information

Author: Msgr. Benton Quitzon

Last Updated:

Views: 5802

Rating: 4.2 / 5 (63 voted)

Reviews: 86% of readers found this page helpful

Author information

Name: Msgr. Benton Quitzon

Birthday: 2001-08-13

Address: 96487 Kris Cliff, Teresiafurt, WI 95201

Phone: +9418513585781

Job: Senior Designer

Hobby: Calligraphy, Rowing, Vacation, Geocaching, Web surfing, Electronics, Electronics

Introduction: My name is Msgr. Benton Quitzon, I am a comfortable, charming, thankful, happy, adventurous, handsome, precious person who loves writing and wants to share my knowledge and understanding with you.