ad_ars_h's profile picture. Adarsh Singh | Frontend Developer 
Problem solving | React.js Developer
UI/UX Backend systems

Adarsh singh

@ad_ars_h

Adarsh Singh | Frontend Developer Problem solving | React.js Developer UI/UX Backend systems

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

ad_ars_h's tweet image. 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

ad_ars_h's tweet image. 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

ad_ars_h's tweet image. 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

ad_ars_h's tweet image. 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.

ad_ars_h's tweet image. 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

ad_ars_h's tweet image. 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

ad_ars_h's tweet image. 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 8 of 100 : Sort Colours We had to sort the colors 0,1,2 in the array, used their count to solve the problem. #leetcode #problemsolving #coding #gfg #cp

ad_ars_h's tweet image. Q 8 of 100 : Sort Colours
We had to sort the colors 0,1,2 in the array, used their count to solve the problem.
#leetcode #problemsolving #coding #gfg #cp

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

ad_ars_h's tweet image. 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

ad_ars_h's tweet image. 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.

ad_ars_h's tweet image. 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.

ad_ars_h's tweet image. 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

ad_ars_h's tweet image. 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.

ad_ars_h's tweet image. 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. 😁

ad_ars_h's tweet image. 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


Q 76 of 100: Maximum Nesting Depth Potd leetcode #coding #leetcode #100daysofcode

ad_ars_h's tweet image. Q 76 of 100: Maximum Nesting Depth 
Potd leetcode 
#coding #leetcode #100daysofcode

444 done 💝💝💝

ad_ars_h's tweet image. 444 done 💝💝💝

United States Trends

Loading...

Something went wrong.


Something went wrong.