In the past few months, I have been actively exploring core concepts behind LLMs - from the basics all the way to decoder-only transformers.
🧠Key concepts behind LLMs
🔐Decoder only architectures
👉Read part 1 of blog series here : tejalrk2000.medium.com/promp…#LLM#transformers#AI
🚀Day31/80 of #gfg160 challenge completed.
✅ Kth missing positive number in sorted array
In a sorted array, finding the first index where arr[i] > (k i) can be optimized. Binary search is preferred to better locate i. Thus kth missing element is k i.
TC: O(logn), SC O(1) #cpp
🚀Day30/80 of #gfg160 challenge completed.
✅ Allocate Minimum Pages
Using binary search approach to minimize page limit. In simple terms, assign books to students until the limit is hit then move to the next student.
TC: O(n*log(Sum(arr)- MAX))
SC: O(1)
#cpp#geekstreak2025
🚀Day29/80 of #gfg160 challenge completed.
✅ Kth element of two Arrays :
Here, I consider two sets for using binary search. We find a point in both arrays so that all elements in first set are smaller than all elements in other. So there is need to check the partitions.
#cpp
🚀Day28/80 of #gfg160 challenge completed.
✅ Peak Element:
Used a binary search approach with time complexity O(logn) and space complexity O(1).
This is the optimized method to retrieve a peak element.
#geekstreak2025#CodingChallenge#cpp
🚀Day27/80 of #gfg160 challenge completed.
✅ Search in rotated sorted Array
Used Binary search approach with O(logn) time and O(1) space complexity.
#cpp#geekstreak2025#CodingChallenge
🚀Day26/80 of #gfg160 challenge completed.
✅ Sorted and Rotated minimum:
Attempted to solve this problem in O(logn) time and O(1) space complexity.
#cpp#geekstreak2025#gfg160
🚀Day24/80 of #gfg160 challenge completed.
✅ Merge Without Extra Space:
Attempted to solve this problem using the Gap sort method.
TC: O(m n)*O(log(m n))
SC: O(1)
#geekforgeeks#geekstreak2025#cpp
🚀 Day23/80 of #gfg160 challenge completed.
✅ Non-Overlapping Intervals :
Attempted to solve this problem using a greedy approach.
TC: O(nlogn)
SC: O(1)
#geekstreak2025#codingchallenge#cpp
🚀Day 22/80 of #gfg160 challenge completed.
✅ Insert Interval: Sorting and Interval merging approach is used here. Time complexity is O(nlogn) and space complexity is O(n). Where n is the number of intervals.
#geekstreak2025#codingchallenge#cpp
🚀 Day20/80 of #gfg160 challenge completed.
✅ Count Inversions: I used Merge sort step to count the Inversions in this problem giving O(nlogn) time and O(n) space complexity.
#cpp#CodingChallenge#geekstreak2025
🚀 Day19/20 of #gfg160 challenge completed.
✅ Sort 0's, 1's and 2's :
Attempted to solve this problem using O(n) time and O(1) space complexity.
#CodingChallenge#geekforgeeks#cpp
🚀Day18/80 of #gfg160 challenge completed.
✅ Min Chars to Add for Palindrome:
Attempted the problem using the KMP algorithm in O(n) time and O(n) space complexity. The min no. of chars to make the string palindrome is the length of the input string minus last entry of lps array.
🚀 Day17/80 of #gfg160 challenge completed.
✅ First Non repeating Char:
Attempted the problem by storing indices in a single traversal.
TC: O(n) where n is length of input string s.
SC :O(MAX_CHAR) where MAX_CHAR=26 as the input string has only lowercase alphabets.
#cpp#gfg160
🚀 Day16/80 of #gfg160 challenge completed.
✅ Anagram: Initialize frequency array of size 26 and use chars as index in this array. Traverse s1, increment the value in array. Traverse s2 and decrement value. As value at every index is 0, the frequency of each char is same.
#cpp
🚀 Day15/80 of #gfg160 challenge completed.
✅ Add Binary Strings:
We first trim leading zeros and then start from the last character of the strings and compute digit sum. If sum>1 then store carry for next digits. For extra carry prepend 1 of the result.
TC:O(n m) SC: O(1)