Q 15 of 100: Longest Consecutive Sequence
Aim: To find out the longest consecutive Sequence in a given array.
Used a set to store the elements, which kept them in a sorted order, later transferred them to a vector and found out the longest sequence
Can be optimised without array
Q 14 of 100: Best time to Buy and Sell Stock
Aim: To find out the best time to buy a stock and then sell in the future. Initially, used 2 arrays for prefix and suffix sum, but later on seeing solutions, realised we just need 2 variables to store the values.
#leetcode#problems
Q 13 of 100: Next Permutation
Aim: To find out the next permutation, provided an already existing permutation.
Prior to problem, we must know the algorithm of finding the next permutation.
Time complexity : O(nlogn)
Space complexity : O(1)
#leetcode#coding#problems
Q 12 of 100: Find most frequent vowel and consonant
Aim: to find the sum of the most frequent vowel's frequency and same for the consonants and return that sum.
#leetcode#potd#coding#practice
Q 11 of 100: Rearrange Array Elements By Sign
Aim: To arrange the elements of an array in alternate positions - Positive and negative.
TC: O(n)
SC: O(n)
Approach: Create another array of the same size, then maintain the indices of the positive and negative numbers. Update them.
Follow up of the Maximum subarray sum :
Just store the indices everytime you update the maximum subarray sum.
Maintain those indices and then just print the whole array, you're good to go 🚀🚀
Q 10 of 200: Maximum Subarray Sum
Aim: To find out the subarray with the maximum sum and then return the maximum subarray sum.
Iterate the array and whenever an element greater than the sum of the subarray and element itself is found, shift subarray.
#leetcode#gfg#CodingLife
Q 9 of 100: Majority Element
Aim: To find out the element which occurs more than 50% of the times in the array.
Approach: Maintain the count of the most freq element, increase every time it occurs and decrease every time it doesn't occur.
#leetcode#arrays#gfg#problemsolving
Q 7 of 100: Two Sum
Aim: Find out the 2 indices which sum up to the provided sum.
Maintained a map for finding out the complementary element existence and its index.
#leetcode#problemsolving
Q 6 of 200: Rotate Array
This is a question which requires good observation, we had to rotate an array by provided k places.
Used the reverse functions smartly for doing the problem, had to take help of tutorials
#leetcode#dsa#grinding
Q5 of 200: Move Zeroes
In this question we were supposed to move all the zeroes of an array to the end of the array while maintaining the relative order of the non zero elements.
Keep an index of nonzero and at the end put the zeroes.
Q4 of 200:
Check if the array is Sorted and Rotated
The aim was to find and return whether the array was sorted and rotated.
2 cases: if sorted not rotated -> no peak will be there, simple
if sorted and rotated -> one peak, if multiple return false else true.
Q3 of 200:
Max Consecutive Ones
Aim: to find the maximum consecutive number of times 1 appears in the array. Used a variable to store the frequency and updated it everytime 1 was encountered, and updated the maxConsecutiveOnes accordingly.
#LeetCode#WIN
Q2 of 200:
Missing number
An array was given, in which there were numbers from 0 to n, but a certain number was missing. Aim was to find the missing number. Used the expected sum and actual sum difference for solving.
Q1 of 200:
Single number
The aim was to find the number that was occurring only once in the array and all the rest of the numbers were occurring twice.
I used the XOR product of all the numbers, since the XOR of a number onto itself will be zero. This finds the single number. 😁
Day -1 of 90 day challenge
Gym in the morning , treadmill 10 min mixed pace 1 km ,
Inclined crunches 30,
Lat pull down 25 , 20+ 15 kg
Side dumbell pull - 20 , 5 kg each
Inclined dumbell press - 36, 5 kg + 7.5 kg reps
Biceps curls - 5 kg, 20
9 Followers 136 FollowingHere you get latest Bangladesh and International News
Please follow our page-https://t.co/0L0b7ldLTs
subscribe channel- https://t.co/roCc4FvxMB
6 Followers 88 FollowingValue Adz is one of the leading Destination Management Company offers the best-in-class tourism facilities with individual, flexible and personalized services.
1K Followers 4K Following🟢 ChartLab: The Duolingo for Traders! 🇺🇸 Trading with easy-to-follow technology real-time data & strategies tailored for beginners to pros. Join our Discord
27 Followers 46 FollowingExperienced MERN stack developer with 2+ years at Trigyn & Flipkart. Specialize in front-end dev. Passionate about crafting seamless user experiences. #MERN
308 Followers 333 FollowingCurious mind exploring the intersection of technology, culture, and creativity.
Here for growth and connecting with tech peeps🧑🏻💻❤️
313 Followers 234 Following" I am a student passionate about coding, technology enthusiast, aspiring software engineer. Constantly learning and exploring the world of computers. 🖥️💻
318 Followers 402 FollowingWeb & Mobile Designer | Creating SEO-Optimized User Experiences That Deliver Results
My Work Samples:
https://t.co/VJ8yg7Y9Us
29K Followers 520 FollowingOfficial BAT Community X.
Official BAT announcements: @AttentionToken
Discord: https://t.co/sAv7mS2HBv
Telegram: https://t.co/zt7r73zMQ0
27 Followers 46 FollowingExperienced MERN stack developer with 2+ years at Trigyn & Flipkart. Specialize in front-end dev. Passionate about crafting seamless user experiences. #MERN
169 Followers 156 Following🚀 Tech Explorer & Dev Extraordinaire 🤖 | Code Magician 🪄 | Automation Aficionado ⚙️ | Music Maestro 🎵 | Crafting the digital realm one pixel at a time 🎨 |
308 Followers 333 FollowingCurious mind exploring the intersection of technology, culture, and creativity.
Here for growth and connecting with tech peeps🧑🏻💻❤️
888 Followers 760 FollowingHumanity awaken. This is the window where we take back our sovereignty and our true power and access higher dimensional knowledge.
2K Followers 666 FollowingJunior iOS Developer | Microsoft Learn Ambassador @ Microsoft | Technical Writer | Passionate about Open Source and Cultivating Future
https://t.co/JLjRHYh90P
313 Followers 234 Following" I am a student passionate about coding, technology enthusiast, aspiring software engineer. Constantly learning and exploring the world of computers. 🖥️💻