Channel Avatar

codestorywithMIK @UCaw58edcO3ZqMw76Bvs0kGQ@youtube.com

76K subscribers - no pronouns :c

- Also available on topmate.io for 1-1 sessions - topmate.io


Welcoem to posts!!

in the future - u will be able to do some more stuff here,,,!! like pat catgirl- i mean um yeah... for now u can only see others's posts :c

codestorywithMIK
Posted 8 hours ago

This Qn was asked today in Microsoft interview to a candidate. (12th Dec, 2024)

K Inverse Pairs Array | Recursion | Memoization | Bottom Up | Optimal Bottom Up | Leetcode 629
https://youtu.be/y9yo1kyW7Bg


Thank you -πŸ™β€οΈπŸ™
#codestorywithmik #codestorywithMIK #mik #MIK

66 - 2

codestorywithMIK
Posted 1 week ago

-------------------------------- SHARE YOUR APPROACHES BELOW -----------------------------------
Hello Everyone,
Since today's POTD is quite simple, I believe no video is required. Hence I am just posting the code for my approach below.

Leetcode - 1455 - Check If a Word Occurs As a Prefix of Any Word in a Sentence
Leetcode Link - leetcode.com/problems/check-if-a-word-occurs-as-a-…

---------------- C++ -------------------
//T.C : O(words * n), words = total number of words, n = length of searchWord
//S.C : O(1)
class Solution {
public:
int isPrefixOfWord(string sentence, string searchWord) {
stringstream ss(sentence);

string token = "";
int index = 1;
while(getline(ss, token, ' ')) {
if(token.find(searchWord, 0) == 0) {
return index;
}
index++;
}
return -1;
}
};


---------------- JAVA -------------------
//T.C : O(words * n), words = total number of words, n = length of searchWord
//S.C : O(1)
class Solution {
public int isPrefixOfWord(String sentence, String searchWord) {
String[] words = sentence.split(" ");

for (int i = 0; i < words.length; i++) {
if (words[i].startsWith(searchWord)) {
return i + 1;
}
}

return -1;
}
}



My DP Concepts Playlist : https://youtu.be/7eLMOE1jnls
My Graph Concepts Playlist : https://youtu.be/5JGiZnr6B5w
My Recursion Concepts Playlist : youtube.com/watch?v=pfb1Z...
My GitHub Repo for interview preparation : github.com/MAZHARMIK/Intervie...
Instagram : www.instagram.com/codestorywi...
Facebook : www.facebook.com/people/codes...
Twitter : twitter.com/CSwithMIK
Subscribe to my channel : youtube.com/@codestorywit...

╔═╦╗╔╦╗╔═╦═╦╦╦╦╗╔═╗
β•‘β•šβ•£β•‘β•‘β•‘β•šβ•£β•šβ•£β•”β•£β•”β•£β•‘β•šβ•£β•β•£
β• β•—β•‘β•šβ•β•‘β•‘β• β•—β•‘β•šβ•£β•‘β•‘β•‘β•‘β•‘β•β•£
β•šβ•β•©β•β•β•©β•β•©β•β•©β•β•©β•β•šβ•©β•β•©β•β•

#coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge
#leetcodequestions #leetcodechallenge #hindi #india #coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers
#leetcodesolution #leetcodedailychallenge#leetcodequestions #leetcodechallenge #hindi #india #hindiexplanation #hindiexplained
#easyexplaination #interview#interviewtips #interviewpreparation #interview_ds_algo #hinglish #github #design #data #google #video
#instagram #facebook #leetcode #computerscience #leetcodesolutions #leetcodequestionandanswers #code #learning #dsalgo #dsa #coding
#programming #100daysofcode #developers #techjobs #datastructures #algorithms #webdevelopment #softwareengineering #computerscience
#pythoncoding #codinglife #coderlife #javascript #datascience #leetcode #leetcodesolutions #leetcodedailychallenge #codinginterview
#interviewprep #technicalinterview #interviewtips #interviewquestions #codingchallenges #interviewready #dsa #hindi #india #hindicoding
#hindiprogramming #hindiexplanation #hindidevelopers #hinditech #hindilearning #helpajobseeker #jobseekers #jobsearchtips #careergoals
#careerdevelopment #jobhunt #jobinterview #github #designthinking #learningtogether #growthmindset #digitalcontent #techcontent
#socialmediagrowth #contentcreation #instagramreels #videomarketing #codestorywithmik #codestorywithmick #codestorywithmikc #codestorywitmik
#codestorywthmik #codstorywithmik #codestorywihmik #codestorywithmiik #codeistorywithmik #codestorywithmk #codestorywitmick #codestorymik #codestorwithmik

120 - 29

codestorywithMIK
Posted 3 weeks ago

********"I will soon post the video for this too. I am travelling today and will reach home tomorrow. Hope you all understand"********


Today's POTD - Leetcode : 862 - Shortest Subarray with Sum at Least K

There is a very similar problem to this for which I had already posted a video - "Leetcode-209 : Minimum Size Subarray Sum"
Watch that first - Video Link - https://www.youtube.com/watch?v=D2Mbo...

Now, this problem is similar but there is one issue that we can have negative numbers as well.
The standard sliding window approach fails for inputs containing negative numbers because the sum can decrease here , invalidating the straightforward shrinking logic. To correctly solve the problem, we need to use a monotonic deque approach, which can efficiently handle both positive and negative numbers in the array.

Here is the code for your reference :
class Solution {
public:
int shortestSubarray(vector<int>& nums, int K) {
int N = nums.size();

deque<int> deq;
vector<long long> cumulativeSum(N, 0); // This stores the cumulative sum

int result = INT_MAX;
int j = 0;

// Compute cumulative sum in the cumulativeSum array using while loop
while (j < N) {
if (j == 0)
cumulativeSum[j] = nums[j];
else
cumulativeSum[j] = cumulativeSum[j - 1] + nums[j];

// If the cumulative sum from the start to j is already >= K, update result
if (cumulativeSum[j] >= K)
result = min(result, j + 1);

// Remove indices from the deque where the subarray sum is >= K
while (!deq.empty() && cumulativeSum[j] - cumulativeSum[deq.front()] >= K) {
result = min(result, j - deq.front()); // Calculate the length of the subarray
deq.pop_front(); // Remove the front index from the deque
}

// Maintain the monotonic property of the deque (increasing order of cumulative sums)
while (!deq.empty() && cumulativeSum[j] <= cumulativeSum[deq.back()]) {
deq.pop_back(); // Remove indices that won't be useful
}

// Add the current index to the deque
deq.push_back(j);

j++; // Increment j to move to the next index
}

// Return the result if we found a valid subarray, otherwise return -1
return result == INT_MAX ? -1 : result;
}
};



I will soon post the video for this too.
I am travelling today and will reach home tomorrow.
Hope you all understand

Thank you
β€ͺ@codestorywithMIK‬
#codestorywithMIK #codestorywithmik

36 - 8

codestorywithMIK
Posted 3 weeks ago

Peace πŸ•ŠοΈβ€οΈπŸ™

Thanks & Regards,
Tumhara MIK

510 - 95

codestorywithMIK
Posted 1 month ago

-------------------------------- SHARE YOUR APPROACHES BELOW -----------------------------------
Hello Everyone,
Since today's POTD is quite simple, I believe no video is required. Hence I am just posting the code for the my approach below. If you want anything more on this problem (for example quickSelect approach), do let me know if the comment section. I will plan to make a video on that.

Leetcode - 2490 - Circular Sentence
Leetcode Link - leetcode.com/problems/circular-sentence

---------------- C++ -------------------
//T.C : O(n)
//S.C : O(1)
class Solution {
public:
bool isCircularSentence(string sentence) {
int n = sentence.length();

for (int i = 0; i < n; i++) {
if (sentence[i] == ' ' && sentence[i - 1] != sentence[i + 1])
return false;
}

return sentence[0] == sentence[n - 1]; //check last and first
}
};


---------------- JAVA -------------------
//T.C : O(n)
//S.C : O(1)
class Solution {
public boolean isCircularSentence(String sentence) {
int n = sentence.length();

// Check for spaces in the string and whether the character before a space
// matches the character after it.
for (int i = 0; i < n; i++) {
if (sentence.charAt(i) == ' ' && sentence.charAt(i - 1) != sentence.charAt(i + 1)) {
return false;
}
}

// Check if the first character matches the last character.
return sentence.charAt(0) == sentence.charAt(n - 1);
}
}


My DP Concepts Playlist : https://youtu.be/7eLMOE1jnls
My Graph Concepts Playlist : https://youtu.be/5JGiZnr6B5w
My Recursion Concepts Playlist : https://www.youtube.com/watch?v=pfb1Z...
My GitHub Repo for interview preparation : github.com/MAZHARMIK/Interview_DS_Algo
Instagram : www.instagram.com/codestorywithmik/
Facebook : www.facebook.com/people/codestorywithmik/100090524…
Twitter : twitter.com/CSwithMIK
Subscribe to my channel : youtube.com/@codestorywithMIK

╔═╦╗╔╦╗╔═╦═╦╦╦╦╗╔═╗
β•‘β•šβ•£β•‘β•‘β•‘β•šβ•£β•šβ•£β•”β•£β•”β•£β•‘β•šβ•£β•β•£
β• β•—β•‘β•šβ•β•‘β•‘β• β•—β•‘β•šβ•£β•‘β•‘β•‘β•‘β•‘β•β•£
β•šβ•β•©β•β•β•©β•β•©β•β•©β•β•©β•β•šβ•©β•β•©β•β•

#coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge
#leetcodequestions #leetcodechallenge #hindi #india #coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers
#leetcodesolution #leetcodedailychallenge#leetcodequestions #leetcodechallenge #hindi #india #hindiexplanation #hindiexplained
#easyexplaination #interview#interviewtips #interviewpreparation #interview_ds_algo #hinglish #github #design #data #google #video
#instagram #facebook #leetcode #computerscience #leetcodesolutions #leetcodequestionandanswers #code #learning #dsalgo #dsa #coding
#programming #100daysofcode #developers #techjobs #datastructures #algorithms #webdevelopment #softwareengineering #computerscience
#pythoncoding #codinglife #coderlife #javascript #datascience #leetcode #leetcodesolutions #leetcodedailychallenge #codinginterview
#interviewprep #technicalinterview #interviewtips #interviewquestions #codingchallenges #interviewready #dsa #hindi #india #hindicoding
#hindiprogramming #hindiexplanation #hindidevelopers #hinditech #hindilearning #helpajobseeker #jobseekers #jobsearchtips #careergoals
#careerdevelopment #jobhunt #jobinterview #github #designthinking #learningtogether #growthmindset #digitalcontent #techcontent
#socialmediagrowth #contentcreation #instagramreels #videomarketing #codestorywithmik #codestorywithmick #codestorywithmikc #codestorywitmik
#codestorywthmik #codstorywithmik #codestorywihmik #codestorywithmiik #codeistorywithmik #codestorywithmk #codestorywitmick #codestorymik #codestorwithmik

162 - 26

codestorywithMIK
Posted 1 month ago

-------------------------------- SHARE YOUR APPROACHES AND JAVA VERSIONS BELOW -----------------------------------
Hello Everyone,
Since today's POTD is quite simple, I believe no video is required. Hence I am just posting the code for the my approach below. If you want anything more on this problem (for example quickSelect approach), do let me know if the comment section. I will plan to make a video on that.

Leetcode - 2583 - Kth Largest Sum in a Binary Tree
Leetcode Link - leetcode.com/problems/kth-largest-sum-in-a-binary-…
class Solution {
public:
long kthLargestLevelSum(TreeNode* root, int k) {
priority_queue<long, vector<long>, greater<long>> pq; //Min Heap

queue<TreeNode*> que;
que.push(root);
while (!que.empty()) {
int n = que.size();
long levelSum = 0;
while (n--) {
TreeNode* poppedNode = que.front();
que.pop();
levelSum += poppedNode->val;
if (poppedNode->left != NULL) {
que.push(poppedNode->left);
}
if (poppedNode->right != NULL) {
que.push(poppedNode->right);
}
}

pq.push(levelSum);

if (pq.size() > k) {
pq.pop();
}
}

return pq.size() < k ? -1 : pq.top();
}
};



My DP Concepts Playlist : https://youtu.be/7eLMOE1jnls
My Graph Concepts Playlist : https://youtu.be/5JGiZnr6B5w
My Recursion Concepts Playlist : https://www.youtube.com/watch?v=pfb1Z...
My GitHub Repo for interview preparation : github.com/MAZHARMIK/Interview_DS_Algo
Instagram : www.instagram.com/codestorywithmik/
Facebook : www.facebook.com/people/codestorywithmik/100090524…
Twitter : twitter.com/CSwithMIK
Subscribe to my channel : youtube.com/@codestorywithMIK

╔═╦╗╔╦╗╔═╦═╦╦╦╦╗╔═╗
β•‘β•šβ•£β•‘β•‘β•‘β•šβ•£β•šβ•£β•”β•£β•”β•£β•‘β•šβ•£β•β•£
β• β•—β•‘β•šβ•β•‘β•‘β• β•—β•‘β•šβ•£β•‘β•‘β•‘β•‘β•‘β•β•£
β•šβ•β•©β•β•β•©β•β•©β•β•©β•β•©β•β•šβ•©β•β•©β•β•

#coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge #leetcodequestions #leetcodechallenge #hindi #india #coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge#leetcodequestions #leetcodechallenge #hindi #india #hindiexplanation #hindiexplained #easyexplaination #interview#interviewtips #interviewpreparation #interview_ds_algo #hinglish #github #design #data #google #video #instagram #facebook #leetcode #computerscience #leetcodesolutions #leetcodequestionandanswers #code #learning #dsalgo #dsa #coding #programming #100daysofcode #developers #techjobs #datastructures #algorithms #webdevelopment #softwareengineering #computerscience #pythoncoding #codinglife #coderlife #javascript #datascience #leetcode #leetcodesolutions #leetcodedailychallenge #codinginterview #interviewprep #technicalinterview #interviewtips #interviewquestions #codingchallenges #interviewready #dsa #hindi #india #hindicoding #hindiprogramming #hindiexplanation #hindidevelopers #hinditech #hindilearning #helpajobseeker #jobseekers #jobsearchtips #careergoals #careerdevelopment #jobhunt #jobinterview #github #designthinking #learningtogether #growthmindset #digitalcontent #techcontent #socialmediagrowth #contentcreation #instagramreels #videomarketing #codestorywithmik #codestorywithmick #codestorywithmikc #codestorywitmik #codestorywthmik #codstorywithmik #codestorywihmik #codestorywithmiik #codeistorywithmik #codestorywithmk #codestorywitmick #codestorymik #codestorwithmik

172 - 42

codestorywithMIK
Posted 1 month ago

Kuch bhi ho.
Consistency break nahi honi chaie.
So guys, β€œAao, Story Se Code Likhe”

β€ͺ@codestorywithMIK‬
#codestorywithmik #codestorywithMIK

602 - 31

codestorywithMIK
Posted 2 months ago

-------------------------------- SHARE YOUR APPROACHES AND JAVA VERSIONS BELOW -----------------------------------
Hello Everyone,
Since today's POTD is very simple, I believe no video is required. Hence I am just posting the code for the my approach below :

Leetcode - 1331 - Rank Transform of an Array
Leetcode Link - leetcode.com/problems/rank-transform-of-an-array
//T.C : O(n*logn)
//S.C : O(n)
class Solution {
public:
vector<int> arrayRankTransform(vector<int>& arr) {
unordered_map<int, int> mp; //number -> rank
set<int> st(begin(arr), end(arr)); //ordered set keeps them in sorted order

int rank = 1;
for(auto &num : st) {
mp[num] = rank;
rank++;
}

for(int i = 0; i < arr.size(); i++) {
arr[i] = mp[arr[i]];
}

return arr;

}
};


My DP Concepts Playlist : https://youtu.be/7eLMOE1jnls
My Graph Concepts Playlist : https://youtu.be/5JGiZnr6B5w
My Recursion Concepts Playlist : https://www.youtube.com/watch?v=pfb1Z...
My GitHub Repo for interview preparation : github.com/MAZHARMIK/Interview_DS_Algo
Instagram : www.instagram.com/codestorywithmik/
Facebook : www.facebook.com/people/codestorywithmik/100090524…
Twitter : twitter.com/CSwithMIK
Subscribe to my channel : youtube.com/@codestorywithMIK

╔═╦╗╔╦╗╔═╦═╦╦╦╦╗╔═╗
β•‘β•šβ•£β•‘β•‘β•‘β•šβ•£β•šβ•£β•”β•£β•”β•£β•‘β•šβ•£β•β•£
β• β•—β•‘β•šβ•β•‘β•‘β• β•—β•‘β•šβ•£β•‘β•‘β•‘β•‘β•‘β•β•£
β•šβ•β•©β•β•β•©β•β•©β•β•©β•β•©β•β•šβ•©β•β•©β•β•

#coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge #leetcodequestions #leetcodechallenge #hindi #india #coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge#leetcodequestions #leetcodechallenge #hindi #india #hindiexplanation #hindiexplained #easyexplaination #interview#interviewtips #interviewpreparation #interview_ds_algo #hinglish #github #design #data #google #video #instagram #facebook #leetcode #computerscience #leetcodesolutions #leetcodequestionandanswers #code #learning #dsalgo #dsa #newyear2024
#CodeStoryWithMICK #CdoeStoryWithMIK #CodeStroyWithMIK #CodeStoryWitMIK #CodeStoryWithMicK #CodeStoreyWithMIK #CdoeStroyWithMIK #CodeStoryWhithMIK #CodeStoryWithMK #CodeStorieWithMIK

180 - 62

codestorywithMIK
Posted 2 months ago

Another Success Story. πŸŽŠπŸŽŠπŸŽ‰πŸŽ‰
#Apple #internship #cracked

Many Many Congratulations πŸ˜‡πŸŽŠβ™₯️


THANK YOU πŸ™β™₯οΈπŸ™
#codestorywithmik #codestorywithMIK

362 - 18

codestorywithMIK
Posted 2 months ago

Seeing this comment early morning made my day. Another Success Story.
#Microsoft #internship

Congratulations πŸ₯³


So guys, β€œAao, story se code likhe”


Note - I hide the name just for the sake of privacy. All the information are authentic without any change.

Thanks & Regards,
Tumhara MIK

#codestorywithmik #codestorywithMIK
#internship #cracked

291 - 27