Thread Reader
Share this page!
×
Post
Share
Email
Enter URL or ID to Unroll
×
Unroll Thread
You can paste full URL like: https://x.com/threadreaderapp/status/1644127596119195649
or just the ID like: 1644127596119195649
How to get URL link on X (Twitter) App
On the Twitter thread, click on
or
icon on the bottom
Click again on
or
Share Via icon
Click on
Copy Link to Tweet
Paste it above and click "Unroll Thread"!
More info at
Twitter Help
Mohit
@_MohitBalwani
21 | SWE @PTC | 2023 Graduate | I tweet about my learnings/Readings/Experience.
Subscribe
Save as PDF
Jun 21, 2022
•
8 tweets
•
2 min read
Day 4 of
#100DaysOfCode
:
Problem Name - Longest Consecutive Sequence
Given an unsorted array of integers "nums", return the length of the longest consecutive elements sequence.
🧵👇 Sample Input :
arr = [100,4,200,1,3,2]
Sample Output:
4
Explanation:
The longest consecutive elements sequence is [1, 2, 3, 4].
Therefore its length is 4.
Save as PDF
Jun 20, 2022
•
6 tweets
•
2 min read
Day 3 of
#100DaysOfCode
:
Problem Name - Longest Mountain in Array
Given an integer array "arr", return the length of the longest subarray, which is a mountain.
🧵👇 Sample Input :
arr = [2,1,4,7,3,2,5]
Sample Output:
5
Explanation:
A mountain is a set of numbers that are strictly increasing until they reach a peak, at which they become strictly decreasing.
So, the largest mountain is [1,4,7,3,2] with peak at 7 and length 5.
Save as PDF
Jun 19, 2022
•
7 tweets
•
2 min read
Day 2 of
#100DaysOfCode
PROBLEM NAME - 3 SUM
Given an array of integers "nums" and an integer "target", find all possible indices of triplets such that they add up to target.
A thread 🧵👇 Approach - 1 : Brute Force
Use 3 "for loops" and check for all possible triplets of numbers that makes the target sum.
Time Complexity - O(n^3)
Space Complexity - O(1)
Save as PDF
Jun 18, 2022
•
8 tweets
•
3 min read
Day 1 of
#100DaysOfCode
:
Problem Name - TWO SUM
Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.
A thread 🧵👇 Approach - 1 : Brute Force
- Use 2 for loops and check for all possible pairs of numbers that makes the target sum.
Time Complexity - O(n^2)
Space Complexity - O(1)