Day 115 complete
Stock Buy and Sell ā Max One Transaction Allowed
Solved Stock Buy & Sell ā Max One Transaction.
A classic: track the minimum price and maximize the profit š°#DSA#100DaysOfCode#LeetcodeEasy#StockProblem#CodingLife
"Leetcode POTD 2185(Easy) : Counting Words with a Given Prefix"
Approach Summary:
Approach 1 (Brute Force)
This approach iterates through all the words and checks if each word starts with the given prefix using find(). If a match is found, the count is incremented.
Time Complexity: O(nā m), where n is the number of words and m is the prefix length.
Space Complexity: O(1).
Approach 2 (Using Trie)
This approach builds a Trie data structure where each node stores the count of words passing through it. After constructing the Trie, it efficiently retrieves the count of words with the given prefix by traversing the prefix path.
Time Complexity: O(nā l m), where l is the average word length and m is the prefix length.
Space Complexity: O(nā l), for storing the Trie.
#CONNECT#learning#LearningJourney#learningproject#learntocode#LearnAndGrow#LearnJava#leetcodeeasy#CodingChallenge#codinglife#CodingJourney
Tackled two easy-level LeetCode problems from Kunal Kushwaha's DSA sheet today! š§ š” Embracing the learning process and making progress in building a strong foundation in data structures and algorithms. #LearningToCode#KunalKushwaha#DSASheet#LeetCodeEasy