[go: up one dir, main page]

0% found this document useful (0 votes)
2 views33 pages

100 Day Coding Challenge

The document is a coding challenge tracker aimed at improving problem-solving skills by completing 250 data structure and algorithm questions over 100 days. It details the progress made so far, with 163 questions completed, categorized by difficulty levels: Easy, Medium, and Hard. Each entry includes the day, question number, topic, and notes on time taken and solutions attempted.

Uploaded by

honeyrathore2712
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views33 pages

100 Day Coding Challenge

The document is a coding challenge tracker aimed at improving problem-solving skills by completing 250 data structure and algorithm questions over 100 days. It details the progress made so far, with 163 questions completed, categorized by difficulty levels: Easy, Medium, and Hard. Each entry includes the day, question number, topic, and notes on time taken and solutions attempted.

Uploaded by

honeyrathore2712
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
You are on page 1/ 33

Youtube

Instagram
100 Days Coding Ch
LinkedIn

QUESTION TRACKER
GOAL : To improve Problem Solving Skills by doing 250 Good D

163
250 Easy
Medium
Hard
Remainin

Day Ques No. Topic Question


Day 1 1 Array Merge Sorted Array
Day 1 2 Array Remove Element
Day 1 3 Array Remove Duplicate from Sorted Array
Day 2 4 Array Remove Duplicates from Sorted Array II
Day 2 5 Array Majority Element
Day 2 6 Array Sort Colours
Day 3 7 Array Jump Game
Day 3 8 Array Jump Game 2
Day 4 9 DP Coin Change
Day 4 10 Array Number of Boomerangs
Day 4 11 Array Find Right Interval
Day 5 12 Array Buy and Sell Stock
Day 5 13 Array Buy and Sell Stock II
Day 6 14 Array Rotate Array
Day 6 15 Array H-Index
Day 6 16 Array Insert Delete GetRandom O(1)
Day 7 17 Array Product of Array Except Self
Day 7 18 Array Gas Station
Day 8 19 Array Candy
Day 8 20 String Length of Last Word
Day 9 21 Array Roman to Integer
Day 9 22 Array Integer to Roman
Day 10 23 String Valid Palindrome
Day 10 24 String Is Subsequence
Day 10 25 Array Two Sum II - Input Array Is Sorted
Day 11 26 String Find the Index of the First Occurrence in a Stri
Day 11 27 String Reverse Words in a String
Day 12 28 Array Trapping Rain Water
Day 12 29 Array 3Sum
Day 13 30 String Substring with Concatenation of All Words
Day 13 31 String Minimum Window Substring
Day 14 32 HashMap Ransom Note
Day 14 33 HashMap Isomorphic Strings
Day 15 34 String Longest Common Prefix
Day 15 35 String ZigZag Conversion
Day 15 36 Array Container with Most Water
Day 16 37 Array Minimum Size Subarray Sum
Day 16 38 Array Longest Substring Without Repeating Characte
Day 17 39 Matrix Valid Sudoku
Day 17 40 Matrix Spiral Matrix
Day 18 41 Matrix Rotate Image
Day 18 42 Matrix Set Matrix Zero
Day 18 43 Matrix Game of Life
Day 19 44 HashMap Word Pattern
Day 19 45 HashMap Valid Anagram
Day 19 46 HashMap Group Anagrams
Day 20 47 HashMap Two Sum
Day 20 48 HashMap Happy Number
Day 20 49 HashMap Contains Duplicate II
Day 21 50 Interval Summary Ranges
Day 21 51 Interval Merge Intervals
Day 22 52 String Text Justification
Day 22 53 HashMap Longest Consecutive Sequence
Day 23 54 Interval Insert Interval
Day 23 55 Interval Minimum Number of Arrows to Burst Balloons
Day 24 56 Stack Valid Parentheses
Day 24 57 Stack Simplify Path
Day 25 58 Stack Min Stack
Day 25 59 Stack Evaluate Reverse Polish Notation
Day 26 60 Stack Basic Calculator
Day 27 61 Linked list Merge Two Sorted Lists
Day 27 62 Linked list Copy List with Random Pointer
Day 28 63 Linked list Linked List Cycle
Day 28 64 Linked list Add Two Numbers
Day 28 65 Linked list Reverse Linked List II
Day 29 66 Linked list Reverse Nodes in k-Group
Day 29 67 Linked list Remove Nth Node From End of List
Day 30 68 Linked list Remove Duplicates from Sorted List II
Day 30 69 Linked list Rotate List
Day 31 70 Linked list Partition List
Day 31 71 Linked list LRU Cache
Day 32 72 Tree Maximum Depth of Binary Tree
Day 32 73 Tree Same Tree
Day 32 74 Tree Invert Binary Tree
Day 33 75 Tree Symmetric Tree
Day 33 76 Tree Construct Binary Tree from Preorder and Inord
Day 33 77 Tree Construct Binary Tree from Inorder and Postor
Day 34 78 Tree Populating Next Right Pointers in Each Node II
Day 34 79 Tree Flatten Binary Tree to Linked List
Day 34 80 Tree Path Sum
Day 35 81 Tree Sum Root to Leaf Numbers
Day 35 82 Tree Binary Tree Maximum Path Sum
Day 35 83 Tree Lowest Common Ancestor of a Binary Tree
Day 36 84 Tree Binary Search Tree Iterator
Day 36 85 Tree Count Complete Tree Nodes
Day 36 86 Tree Binary Tree Right Side View
Day 37 87 Tree Average of Levels in Binary Tree
Day 37 88 Tree Binary Tree Level Order Traversal
Day 38 89 Tree Binary Tree Zigzag Level Order Traversal
Day 38 90 Tree Minimum Absolute Difference in BST
Day 39 91 Tree Validate Binary Search Tree
Day 39 92 Tree Kth Smallest Element in a BST
Day 40 93 Maths Palindrome
Day 40 94 Maths Plus One
Day 40 95 Maths Factorial Trailing Zeroes
Day 40 96 Maths Sqrt(x)
Day 41 97 Maths Pow(x, n)
Day 41 98 Maths Max Points on a Line
Day 42 99 Bits Add Binary
Day 42 100 Bits Reverse Bits
Day 42 101 Bits Number of 1 Bits
Day 42 102 Bits Single Number
Day 43 103 Bits Single Number II
Day 43 104 Bits Bitwise AND of Numbers Range
Day 44 105 Arrays Maximum Subarray
Day 44 106 Arrays Maximum Sum Circular Subarray
Day 45 107 Heaps Kth Largest Element in an Array
Day 45 108 Heaps IPO
Day 46 109 Heaps Find K Pairs with Smallest Sums
Day 46 110 Heaps Find Median from Data Stream
Day 47 111 Binary Search Search Insert Position
Day 47 112 Binary Search Search a 2D Matrix
Day 48 113 Binary Search Find Peak Element
Day 48 114 Binary Search Search in Rotated Sorted Array
Day 48 115 Binary Search Find First and Last Position of Element in Sort
Day 49 116 Binary Search Find Minimum in Rotated Sorted Array
Day 50 117 Binary Search Median of Two Sorted Arrays
Day 51 118 BackTracking Letter Combinations of a Phone Number
Day 51 119 BackTracking Combinations
Day 51 120 BackTracking Permutations
Day 52 121 BackTracking Combination Sum
Day 52 122 BackTracking Generate Parentheses
Day 52 123 BackTracking Word Search
Day 53 124 BackTracking N-Queens II
Day 53 125 Divide & Conquer Convert Sorted Array to Binary Search Tree
Day 53 126 Divide & Conquer Sort List
Day 54 127 Divide & Conquer Construct Quad Tree
Day 54 128 Divide & Conquer Merge k Sorted Lists
Day 55 129 DP Climbing Stairs
Day 56 130 DP House Robber
Day 56 131 DP Word Break
Day 57 132 DP Longest Increasing Subsequence
Day 57 133 DP Triangle
Day 57 134 DP Minimum Path Sum
Day 58 135 DP Unique Paths II
Day 58 136 DP Longest Palindromic Substring
Day 59 137 DP Interleaving String
Day 59 138 DP Edit Distance
Day 60 139 DP Maximal Square
Day 60 140 DP Best Time to Buy and Sell Stock III
Day 61 141 DP Best Time to Buy and Sell Stock IV
Day 61 142 Graph Number of Islands
Day 62 143 Graph Surrounded Regions
Day 62 144 Graph Clone Graph
Day 63 146 Graph Course Schedule
Day 63 147 Graph Course Schedule II
Day 64 149 Graph Snakes and Ladders
Day 64 150 Graph Minimum Genetic Mutation
Day 65 151 Graph Word Lafdder
Day 65 148 Graph Evaluate Division
Day 66 151 Trie Implement Trie (Prefix Tree)
Day 66 152 Trie Design Add and Search Words Data Structure
Day 67 153 Trie Word Search II
Day 68 154 Graph Distance from the Source (Bellman-Ford Algor
Day 68 155 Graph Implementing Dijkstra Algorithm
Day 69 156 Graph Minimum Spanning Tree
Day 69 157 Graph Floyd Warshall
Day 70 158 Graph Bipartite Check using BFS
Day 70 159 Graph Bipartite Check using BFS
Day 71 160 Graph MST using Kruskal Algo
Day 71 161 Graph Maximum Number of Non-Overlapping Substri
Day 72 162 Graph Detonate the Maximum Bombs
Day 72 163 Arrays Meeting Rooms III
oding Challenge
by Siddharth Singh
TION TRACKER
kills by doing 250 Good DSA Questions in 100 Days

SUMMARY:
Total Done 163
Easy Easy 40
Medium
Medium 103
Hard
Hard 20
Remaining
Remaining 87

Tag Time Taken Solution Link Notes


Easy 18mins 5 secs
Easy 8 mins 18 secs
Easy 7 mins 47 secs
Medium 8 mins 1 secs
Easy 11mins 24 secs https://drive.google.com/file/d/11uSue5jbImZVddcQE6aiyuk8
Medium 15mins 58 secs Dutch flag Algo h isme mene kar toh diyaa tha question but
Medium 9 min 49 secs
Medium 9 min 1 secs
Medium FLIGHT CHALLENGE
Medium FLIGHT CHALLENGE Time limit exceeded becasue i tried brute force approach
Medium FLIGHT CHALLENGE Initially compile time error in the challenge
Easy 18min 23 secs isme pata nahi kya bina samjhe ache se kuch bhi logic lagae
Medium 35 mins 2 secs iska sabse efficient tarika jo 4 line of code me ho rha tha vo
Medium 5mins 55 secs
Medium 29mins 26 secs isme bhi starting me logic hi galat banaya mtlb isme bhi alag
Medium 32mins 18 secs
Medium 8 mins 28 secs Easy tha yeh question toh
Medium 21min 24secs Isme jo solution dekha usme kitna sahi bataya h ki yadi total
Hard 58mins 41 secs Optimised toh kar liyaa lekin isme bhi mene bhot bada code
Easy 9mins 14 secs
Easy 7 mins 8secs
Medium 47mins 38secs isme toh sirf string me "" ki bajah mene ' ' kar liya toh answe
Easy 8mins 4secs isme mene yeh mistake kardi thi ki question dhang se padhn
Easy 10mins 23secs 2 pointers approach
Medium 7mins 12secs
Easy 6 mins 19 secs Simple yeh toh brute force approach se hi ho gaya
Medium 26 mins 41secs Yeh basically 2 pointer ka hi badiyaa application h kyuki ism
Hard 13mins 12 secs
Medium 16mins 29secs isme duplicates nahi hona chaiye vo case ko thoda handle k
Hard 57mins 2 secs Isme bhi sub string ka batana tha and intuiton thi ki fixed len
Hard 22mins 19 secs
Easy 4mins 3 secs
Easy 17 mins 33 secs Isme mene galti kya kari thi ki mene jo map ho rahe h ek du
Easy 39mins 8 secs isme toh me galti kar raha tha ki vo empty "" string vala case
Medium 19mins 41secs
Medium 34mins 17secs Isme bhot time tak me samaj hi nahi paaya tha kya approac
Medium 14mins 10secs Sliding window concept lagega isme mene ek choti si logic k
Medium 9mins 4secs isme bhi ek chez yeh ho gaya h ki edge case me string me e
Medium 21mins 50 secs The optimised approach is brilliant and new!!! It uses Set wit
Medium 24mins 17secs isme mere test fail ho raha tha jab ander sirf ek hi coloumn y
Medium 16mins 42secs https://drive.google.com/file/d/1t_CMiC2sleyNiRGB05Pt7pqkTr9OFB34/view?usp
submission vala solution masst h ekdum 4 line ka sirff mene
Medium 4mins 8 secs https://drive.google.com/file/d/1t_CMiC2sleyNiRGB05Pt7pqkTr9OFB34/view?usp
yeh toh mene hashmap use karke simple tarike se karliyaa:
Medium 33 mins 39 secs https://drive.google.com/file/d/1t_CMiC2sleyNiRGB05Pt7pqkTr9OFB34/view?usp
Isme bhi jo inplace without any extra space use karne ke liye
Easy 19mins 5 secs isme words ko alag kese karna h vo main chez thi toh uske
Easy 6mins 27secs
Medium 12mins 48secs sort karke map bana diyaa
Easy 3mins 3 secs
Easy 4mins 8 secs iss question ko Floyd Algorithm se bhi solve kar skte h yeh m
Easy 3mins 18 secs isko dekh ke esa lag sakta h ki sliding window kuch lagega b
Easy 12min 24 secs
Medium 14min 21 secs Isme main toh Compartor vali chez thi ki vo aani chaiye thi!!!
Hard 51mins 11secs https://drive.google.com/file/d/1KP0zYag_7AcVaA7OtPRVWxvJB_ByzxmE/view?
main isme mtlb bas implementation ka h logic toh ohk ohk h
Medium 19mins 8 secs https://drive.google.com/file/d/1KP0zYag_7AcVaA7OtPRVWxvJB_ByzxmE/view?
isme mene initially galti kadi thi ki mene yeh pre assume kar
Medium 46mins 3secs Mene bhot ese if else condition laga ke kara h isi ka consice
Medium 17mins 31 secs achaa tha question yeh badiyaa yeh ek baar revisit karnah k
Easy 4mins 18secs
Medium 20mins 48 secs isme ek galti yeh ki thi ki pop karne se phle mene stack chec
Medium 12mins 1 secs Isme question toh ho gaya yeh Vo Max in K sliding window t
Medium 9mins 11 secs Isme minor ek logic me mistake kardi thi initially vo yeh tha k
Hard 1 Hr Time Limit Over isme basically kuch case me solve nahi kaaa paya toh me a
Easy 5mins 8 secs
Medium 9mins 4 secs Iska jo Bina Space use karne vala solution h na vo badiyaa
Easy 6 mins 44 secs isme EDGE CASE HANDLE nahi kara jab head null hoga to
Medium 16 mins 8 secs Iska logic aur code toh 4-5 min me hi kar liya tha lekin ussm
Medium 16mins 8secs Linkedlist me ek tactic mene yeh dekha h ki head ke aage d
Hard 24mins 23 secs isme ek bhot hi silly mistake kar raha tha uss chakkar me za
Medium 8mins 11secs
Medium 14mins 3secs isme bas vo NULL pointer
Medium 9mins 31 secs
Medium 7mins 9secs isme mene yeh mistake kardi thi ki jo dummy banaya tha for
Medium >1HR
Easy 1 min 31 secs
Easy 1 min 59 secs
Easy 2 mins 1 secs
Easy 5 mins 13 secs
Medium 24 mins 58 secs
Medium 3 mins 7 secs
Medium 15 mins 56 sec Level Order traversal karna padega isme and haar level khtm
Medium 12 min 31secs Recursive call laga diyaa and return me last ka node return
Easy 5 min 16secs targetsum me current node ka minus karke left or right me re
Medium 3 mins 42secs isme bas leaf node ki condition lagani h and no pass karte ja
Hard 8 mins 16secs isme mene bas vo galat samaj liya tha ki path will start from
Medium 14mins 8 secs
Medium 49mins 39secs isme sabse phle toh assume hi kar liyaa tha mene kuch aur
Easy 24 secs simple 3 line ka code h recursive
Medium 7mins 4secs Isko 3 line me bhi recursion jese kar sakte h Pre ORDER tra
Medium 6mins 13secs Level order traversal
Easy 5 mins 22secs Level order traversal Isme silly mistake me kar raha tha ki no
Medium 4mins 24secs Level order traversal using queue
Easy 9mins 49secs The concept of using prev variable and not using extra spac
Medium 11mins 6secs Isme range vala concept use karna padegaaaa and sabse im
Medium 12mins 9secs
Easy 4mins 0 secs Isme bas jo condition h ki integer bada ho sakte h usme mer
Easy 3mins 51 secs
Medium 13mins 29secs isme trailing zeros ke liye hame 5 ki power ginna h and isme
Easy 3mins 2secs isme multiply kara and overflow ho gaya isme bhi long long
Medium 7mins 18secs Isme jo ek edge case h vo fass jaa rha h jisme 2^-31 ho rah
Hard 17mins 24 secs isme edge case h jab ek hi point ho bas toh usme mene phle
Easy 15mins 54 secs Ek galti jo me kar raha tha jiske chakkar me itna time laga vo
Easy 13mins 3secs thoda sa input me confuse ho gaya tha kyuki question me bo
Easy 31secs Learning: to Iterate the bits of a number we will use right shi
Easy 5mins 26 secs XOR karna h and XOR ka identity element 0 hota hai
Medium 22mins 45 secs Isme hint leni padh gae thi toh isme apn ko basically bit pe ja
Medium 19mins 12secs iska mene thoda bada kardiyaa but jo solution tab me 4 line
Medium 24mins 3 secs Iska Kadane algorithm se toh 2 mins 48secs me karliyaa tha
Medium 41mins 40 secs Isme 3 Cases h jo address karne padengee
Medium 11mins Jab bhi apko sorted vali proeprty chaiye h toh think of heap/
Hard 18mins 31secs Isme pair bana ke sort kara mene uske baad heap use kara
Medium 58mins 43secs isme priority queue bana h kyuki apn store karenge k smalle
Hard 41mins 31secs isme 2 heap use karna padegaa max and min and ham arra
Easy 5mins 4secs Isme me index galat return kar raha tha mtlb right kar raha t
Medium 6mins 49 secs Consider same as 1D sorted array
Medium 46mins 03 secs SOLTION DEKHNA PADHAAA USKE BAAD BANA
Medium 24mins 8 secs I solved without finding the Pivot element index so in that we
Medium 24mins 54secs MENE COMPLEX tarike se kara h isme jo corner case h ki l
Medium 53mins 6 secs Me bhot zada confuse ho gaya hu ki kab left<right karna h k
Hard >1HR Yeh question O(n) me karliyaa tha lekin log(n) vala nahi ho p
Medium 24mins 20 secs
Medium 21mins 4secs
Medium 4mins 8 secs
Medium 11mins 45 secs
Medium 8mins 31 secs
Medium >1HR EK BHOT HI CHOMU si mistake kardi mtlb mujhe samaj na
Hard 27mins 57 secs conditions bas thodi zada lagae h toh us vajah se time lag g
Easy 8 mins 13 secs normally array ko mid se divide karna h and then build karna
Medium 23mins 5 secs MERGE SORT ON LINKEDLIST
Medium 18mins 16 secs New and good question
Hard 14mins 26 secs Normally do do karke merge kara h list ko
Easy 3mins 4 secs 1D Dp ka easy question hi h
Medium 7mins 48secs Previous 2 values use karni h
Medium 16mins 6 secs
Medium 7mins 4 secs Mene isko O(n*n) me kara tha See solution to know various
Medium 18mins 31secs 2D DP use hoga
Medium 11mins 21secs
Medium 13mins 10secs Isme vo case dhyan dena h jab inital position pe hi blocker h
Medium 46mins 39secs Isme DP vala case mera time limit exceed kar raha tha kyuk
Medium 1hr 19mins Ekdum kuch naya hi question dekha h mene toh 4D DP se k
Medium 28mins 21secs
Medium 22mins 6secs Same as Edit distance isme mene O(n) apply kara thoda sill
Hard 41 mins 11 secs
Hard 1HR> Lot of confusion so I have read the solution: Refer my Soluti
Medium 17mins 2secs Simple mistake in DFS negative index check nahi kar raha t
Medium 16 mins 24secs
Medium 21mins 7secs isme visited map mene node*, node* ka bana liya jisme old
Medium 14mins 42secs Question is to detect Cycle in a DIRECTED GRAPH: in this
Medium 19mins 8secs Same upar vale solution me bas answer list ek aur chez add
Medium >1HR Use BFS Isme me DFS laga raha tha aur 1 ghnte isme waste kardiyee
Medium 15mins 47secs BFS
Hard 8mins 6secs Same as Above
Medium 24mins 19secs DFS Based hi question tha
Medium 18 mins 6 secs As per learnt from theory same chez apply kari h
Medium 21 min 8 sec Recursive Search isme apply karna tha kyuki '.' vali chez ko
Hard 1hr 41mins 42secs Bhot bhenkar questioisme trie insert,traverse and delete operation lagega and intu
Medium 12mins 9mins Read Article from GFG
Medium 16mins 21mins Read Article from GFG
Medium 17mins 6secs
Medium 19mins 4secs
Medium 12mins 29secs
Medium 18mins 46secs isme me ek bhot hi silly mistake kar diyaa tha jis vajah se an
Medium 42mins 11 secs Refered Youtube Video
Hard 1hr> Refered GFG Article Based on Kosa Raju Algorithm
Medium 38mins 32secs Based on DFS & Maths
Hard 41mins 49secs I solved it in O(n*n) but it can be solved in O(nlogn) using pr
e5jbImZVddcQE6aiyuk8grqlIvC8/view?usp=sharing
diyaa tha question but fir bhi ek choti condition miss kardi thi kyuki itne ache seunderstanding nahi thi toh isko bhi ek baar baa

brute force approach

e se kuch bhi logic lagae jaa raha tha me


code me ho rha tha vo badiya simple and mast tha

naya mtlb isme bhi alag hi direction me soch raha th: yeh quetion thoda ese confusing sa laga to understand
ahi bataya h ki yadi total sum <0 h toh answer -1 h other wise fir toh jaha negative h uske aage vale ko start kardo me zabardas
hi mene bhot bada code kara h bhot jabki 8 lines hi h basss bhot ahca intution lag gaya isse

ne ' ' kar liya toh answer galat aa raha tha aur me debug bhi nahi kar paa raha tha ki mistake kaha hue h!!
uestion dhang se padhna hi nahi ki numeric ko bhi consider karna h toh uss chakar me ek baar run karne me fail ho gaya toh is

se hi ho gaya
application h kyuki isme phle spaces hatane h and then fir uske baad alag alag words ko fir reverse karna h and then answer n

case ko thoda handle karne me galti ho sakti h toh uske liye sabse badiyaa tarika h ki final answer ham set me store karenge t
d intuiton thi ki fixed length ki hi substring hoti toh isse hame thought aana chaiye ki 2 pointer h

jo map ho rahe h ek dusre se toh yeh condition check nahi kara tha ki jo dusra charcter h vo already kisi se linked ya mapped t
empty "" string vala case nahi le raha tha uss chakar me galat h jataa h and iska optimised tarika yeh hoga ki sort karke bas firs

paaya tha kya approach lagau me kich ese soch raha tha ki heights ko store karke rakho ascending order me fir lowerbound n
mene ek choti si logic ki galti kardi thi toh mene usko run kara fir thoda debug kara toh samaj aagaya bhot hi minor logic me er
dge case me string me empty vali chez nahi dekhaa uss chakar me kaam fasss gaya toh string jab bhi ho toh empty vala case t
nd new!!! It uses Set with a very new approach My appraoch was with 4 for loop but inhone 2 loop me hi kardiya question solve
nder sirf ek hi coloumn ya row h toh usme vo duoble baar print kar de raha tha isi liye apn ko if condition lagani padegi check ka
dum 4 line ka sirff mene toh thoda lambaa tarike se kara
mple tarike se karliyaa: isko bina extra space use kare matrix ki first row and first coloum ko use kar skte h ki konsa row me ze
space use karne ke liye hamne same hi matrix me alag tarike se save kara vo chez badiya thi iss question ki and 8 durections
main chez thi toh uske liye stringstream use kar liyaa h function jisse words alag alag ho jate h and secodnly bijection function

hi solve kar skte h yeh mene submission me approach dekhaa o(1) space me: Circular LL ka variant h ek tarike se: https://leetc
g window kuch lagega but isme simply bas hashmap use hoga

hi ki vo aani chaiye thi!!!


ka h logic toh ohk ohk h bus uss logic ko code karne me zada meko time lag gaya!!!
ene yeh pre assume kar liyaa tha ki jab me traverse karunga toh mujhee sequence ka sabse minimum vali value milegi toh me
ke kara h isi ka consice code Submission tab me h vo sahi h 3 while loop use karke kara h https://leetcode.com/problems/inse
ek baar revisit karnah kyuki yadi yeh ese rtandomly aajata na question toh shyd banta nahi vo toh abhi uske upar vale question

se phle mene stack check nahi kara ki empty toh nhi th atoh vo ab dhyaan dena h ki pop ke phle hamesha check karna h secon
ax in K sliding window types hi question laga thoda but isme mene stack stl use kara h and jab mene solution tab me dekha toh
i thi initially vo yeh tha ki me ulta divide kar raha tha a/b ki jagah b/a kyuki mene jo phela top nikla usko me first consider kasr r
ahi kaaa paya toh me abhi solution dekha lekin usse bhi zada samaj ni aaya nahi h toh youtube video dekha h and then code k

olution h na vo badiyaa h ekdum toh vo refer karlena ek baar


ra jab head null hoga toh vo dikat aa gae!!!
i kar liya tha lekin ussme itni silly mistake kari mtlb phle toh while loop me iterate kar raha toh node ko next hi nhi kar raha toh i
kha h ki head ke aage dummy node bana do toh usse head bhi yadi operation me change karna padh raha h toh apn ko alag se
a tha uss chakkar me zada time lag gaya. isme me next set of K group ke liye galat point kar raha tha issi liye dikat aa rahi thi

o dummy banaya tha for heads of two LL toh usme mene dummy ka next current LL ka head kardiyaa tha jab ki NULL karna tha

sme and haar level khtm hone pe NULL daalna h queue me


me last ka node return karega function taki LinkedList ko connect kar pae
s karke left or right me recursive call laga diyaa
ni h and no pass karte jana h abhi tak jo baan gaya h
ha ki path will start from leaf nodes toh uske vajah se starting me condition galat likh di thi

yaa tha mene kuch aur fir baad me samaj aaya ki question alag h then fir isme basically meko flatten the binary tree h na vahi k

sakte h Pre ORDER traversal laga ke jo mene logo ke solutions dekhe toh samaj aaya Mene Level Order Traversal kara tha an

ke me kar raha tha ki node ko galti se answer me push kar raha tha jabki node->val karna tha toh vo bas ek baar error aaya th

nd not using extra space is good. https://leetcode.com/problems/minimum-absolute-difference-in-bst/solutions/99905/two-soluti


padegaaaa and sabse important jab range dungaa na toh INT_MIN AND INT_MAX nahi lena h isme apn ko LONG_MIN and LO

da ho sakte h usme mere case fail ho gyaa tha kyuki mene int liya tha aur apn ko long lena padegaa

power ginna h and isme facto ke time hame yeh dekhna h ki 5,25,125 me jese multiplr 5 h uuske ander hi
aya isme bhi long long int lena padegaa varna fir yahi problem ho gae h same
ha h jisme 2^-31 ho rahi h toh isme kya h ki jab iss power ko positive kar rahe h na toh vo range ke bhaar chale jaa rahi h n ke
bas toh usme mene phle mx ko INT_MIN liya tha jo ki ab me lunga 1 tykuki minimum 1 to aaega hi line me
kkar me itna time laga vo yeh tha ki last me jab carry bach raha tha toh me usko add nahi kar raha tha
ha kyuki question me bola h binary string diya h ese unsigned_int toh meko laga ki yeh unsigned int as an integer hi h na ki bin
ber we will use right shift operator
ement 0 hota hai
apn ko basically bit pe jaake sum karna h and then dekhna h divisble by 3 h toh mtlb
o solution tab me 4 line ka code h vo mastt badiyaa laga: while(m!=n) vali condition https://leetcode.com/problems/bitwise-and-
48secs me karliyaa tha lekin follow up question jo divide and conquer se karna tha usko sochne me time lag gaya kyuki me so

aiye h toh think of heap/priority queue. in this we are using min head so for that we will declare the priortiy queue as below: prior
ke baad heap use kara maximum nikalne ke liyee
n store karenge k smallest elemetn toh iske lioye max heap use karenge and jab bhi max heap ke top element se chota koe aae
x and min and ham array ko adhe adhe me store karenge and secondly isme ham rebalancing karenge haar baar jab bhi elemt
tha mtlb right kar raha tha jabki left value return karni thi yadi element naa mile toh

E BAAD BANA
ment index so in that we needed 6 conditions whoch became complex so we need to directly find the pivot element and solve s
me jo corner case h ki last aur first elemtn ka vo aher se handle nahi kara tha jiske vajah se error ayaa tha first time me fir vo re
kab left<right karna h kab left=mid karna h kab mid+1 karna h toh vo sab thoda sochne samjhne me time chala gaya iss quest
kin log(n) vala nahi ho paya toh uss vajah se fir

di mtlb mujhe samaj nahi aa rha usse time limit exceed kyu aa rha h but usko pakande me itna zada time lag gaya bas ek varia
h us vajah se time lag gaya tha
a h and then build karna h

olution to know various method to solve the same question!!

position pe hi blocker h toh uss case me toh fir answer zerpo hi h mene yeh case cover nahi kara tha
xceed kar raha tha kyuki me jab 2 length ka substring tha tab bhi recursion call kar raha tha toh zada calls lag jaa rahe the btw
h mene toh 4D DP se kara basically isko solve.Discussion dekhne ke baad toh lag rha h mene kitna subardastti complex kardi

(n) apply kara thoda silly mistake kar diyaa tha first wo and first coloumn valo ko max me naa consider karke jiske chakkar me
olution: Refer my Solution for understanding: https://leetcode.com/problems/best-time-to-buy-and-sell-stock-iv/submissions/113
ex check nahi kar raha tha vo galti kardi matrix me

* ka bana liya jisme old or new save kar rakha h node corresponsing
ECTED GRAPH: in this we have the current path and if any node is directing again to current paths node that means we have a
wer list ek aur chez add kardi h
nte isme waste kardiyee mene but hamesha yaad rakhnaa jab bhi single source se shortest distance nikalni h toh BFS use hot

apply kari h
ha kyuki '.' vali chez ko use karnaa h toh sare possible search karne padenge
peration lagega and intution yeh ki constraintn dekhnke samaj aaega ki backtracking hame use karni padegi but usko optimize

diyaa tha jis vajah se answer galat aa rha tha

ved in O(nlogn) using priortiy queue


i toh isko bhi ek baar baad me revisit karna h
o start kardo me zabardasti complex bana deta hu code ko : M

arne me fail ho gaya toh isi liye meko questions dhng se padhna h

karna h and then answer niklega final inplace without using any extra space!! Iske baad mene isko yadi function use karke bina

am set me store karenge toh fir duplicate vali chez haat jaegi: Isme thought yeh h ki jab bhi esa bola jae na ki answer me duplic

kisi se linked ya mapped toh nahi h esaa!!! toh uske liye ek hashmap. fir mene aur banaya jo denote kar raha h ki kon kon se c
hoga ki sort karke bas first and last ko dekh lena h!!

order me fir lowerbound nikalenge esa karke kuch kuch fir baad me samaj aaya ki yeh toh 2 pointers se ho raha h sidhe sidhe a
a bhot hi minor logic me error tha ek line upar niche karne ka: Jab bhui subarray ka kuch nikalna h toh yeh intution rahega ki try
i ho toh empty vala case toh dekhna hi h
e hi kardiya question solve!!!!
on lagani padegi check karne k liye ki kya vo single row ya coloumn jo sabse ander h vo toh nhi h .....Isko sidha 4 pointer appr

kte h ki konsa row me zero hoga and konse coloumn me : Refer submission tab - https://leetcode.com/problems/set-matrix-ze
estion ki and 8 durections me search karne ke liye hamne sidha vector bana liya direction ka. vo bhi acha h logic !!
ecodnly bijection function bole toh 1 to one mapping isi me mene gali kardi thi ki jese same words alag alag char se maop kar d

h ek tarike se: https://leetcode.com/problems/happy-number/solutions/56917/my-solution-in-c-o-1-space-and-no-magic-math-pr

m vali value milegi toh me uss hisab se code likh diya tha but usme fir usse kam: I used two hashmap it can be done using one
etcode.com/problems/insert-interval/solutions/1327206/99-16-faster-proper-explaination-c-solution-o-n/?envType=study-plan-v2
hi uske upar vale question same type me the toh vesa dimag chal gaya

esha check karna h secondl;y hamne base condition jisme koe directory nahi rahegi vo vala cover nahi kara tha toh usme hame
solution tab me dekha toh isko bina stl ke LinkedList se bhi kar sakte h toh vo interview ke hisab se acha laga https://leetcode.
ko me first consider kasr raha tha jabki vo second interger hoga operation me
o dekha h and then code kara usko

o next hi nhi kar raha toh infinite run ho jaa raha tha then fir upar head ko declare kara toh usko NULL nahi kara toh uski vajah s
raha h toh apn ko alag se usko address nahi karna padhta at the end apn ko bas dummu->next dena rehta h
issi liye dikat aa rahi thi

tha jab ki NULL karna tha otherwise cycle ban jaega when extreme case honge toh

the binary tree h na vahi karna h bas inordered me karna h toh isme pair return karna padh raha tha first and last node ka and

Order Traversal kara tha and last node ko har level ke store karna tha vector me last node find karne ke liye ham haar level ke e

bas ek baar error aaya tha run karte time

solutions/99905/two-solutions-in-order-traversal-and-a-more-general-way-using-treeset/?envType=study-plan-v2&envId=top-int
apn ko LONG_MIN and LONG_MAX lena h otherwise jo INT_MAX vali value ka root hoga uska answer galat aa jaega

haar chale jaa rahi h n ke kyuki 2^31 hi range me h uskeee


as an integer hi h na ki binary string h toh uske vajah se zada time lag gaya question toh ese easy hi tha

om/problems/bitwise-and-of-numbers-range/solutions/56729/bit-operation-solution-java/?envType=study-plan-v2&envId=top-int
time lag gaya kyuki me soch raha tha ki kuch tagdi approach hogi but vo toh simply mtlb preffix and suffix calculate karliyaa tha

ortiy queue as below: priority_queue <int, vector<int>, greater<int>> q;

element se chota koe aaega toh maxheap ko pop karenge andhten push kardenge naye sum ko
ge haar baar jab bhi elemtn add karenge toh kyuki hamesha halfs balanced hone chaiye infact hamne esa liya h ki left half me h

pivot element and solve simply by binary search tradition algo....


a tha first time me fir vo resolve karliyaa!! Solution tab me jo h ans vo bhot straigforward h: https://leetcode.com/problems/find
time chala gaya iss question me

time lag gaya bas ek variable meko global set karna tha aur mene usko local kardiyaa toh uss chakkar me time limit exceed aa

calls lag jaa rahe the btw isko sidhaaa bina DP ke 2 pointer se bhi kar skte h toh baaad me mene usse bhi question try kara
subardastti complex kardiyaa tha question ko

er karke jiske chakkar me time lag gaya


-stock-iv/submissions/1137696321/?envType=study-plan-v2&envId=top-interview-150

ode that means we have a cycle: I learnt this from my notes

nikalni h toh BFS use hota h naa ki DFS mene vahi galti kardi iss question me

padegi but usko optimize karne ke liye trie use kara


di function use karke bina O(1) me karne ke liye short taruka dekha toh vo stream se hoga: https://www.geeksforgeeks.org/pro

ae na ki answer me duplicates na ho toh usko sidha set me store karo toh duplicate vali chez toh khtm hi ho jaegi usko alag se

kar raha h ki kon kon se character used up ho gae h ab

se ho raha h sidhe sidhe and yeh mere vale approach se bhi ho jaega but usme doo baar fir iteration lagega mene yeh socha t
yeh intution rahega ki try karna sliding window ho sakta h

.Isko sidha 4 pointer approach se solve karelnge toh usme samjhana bhot aasan h

m/problems/set-matrix-zeroes/solutions/3172908/best-c-4-solution-hash-table-matrix-brute-force-optimize-one-stop-solution/?e
acha h logic !!
g alag char se maop kar diya tha toh vo nahi karn ah isi liye apn ko do map use karne h : https://www.geeksforgeeks.org/strings

ce-and-no-magic-math-property-involved/?envType=study-plan-v2&envId=top-interview-150

it can be done using one as well( saw that frm solution tab)
n/?envType=study-plan-v2&envId=top-interview-150

hi kara tha toh usme hame ek / lagana padega toh vo alag tairke se handle kara: mene isko karne me do stack use kar liya tha
acha laga https://leetcode.com/problems/min-stack/solutions/49010/clean-6ms-java-solution/?envType=study-plan-v2&envId=to

nahi kara toh uski vajah se pura answer phaatt raha tha mtlb vahi h ki yadi sirf code likhna start kar deta hu na bina likhetoh ku

first and last node ka and isme mene ek silly mistake bhi kardi thi uske chakkar me time chala gaya tha

e liye ham haar level ke end pe NULL daal rahe h queue me

udy-plan-v2&envId=top-interview-150
er galat aa jaega
udy-plan-v2&envId=top-interview-150
uffix calculate karliyaa tha. Refer this: https://leetcode.com/problems/maximum-subarray/solutions/1595195/c-python-7-simple

esa liya h ki left half me hi unbalanced ho yadi ho bhi toh. Isme yeh mistake ek krdi thi ki vector ki size nikal ke minus kar raha

etcode.com/problems/find-first-and-last-position-of-element-in-sorted-array/solutions/14699/clean-iterative-solution-with-two-bin

ar me time limit exceed aa gaya

e bhi question try kara


ww.geeksforgeeks.org/program-extract-words-given-string/

m hi ho jaegi usko alag se handle nahi karna padega

lagega mene yeh socha tha ki right vale ko samjhenge jab vo minimum h uski hieght oh ham usse bade vali height ko hi dhund

mize-one-stop-solution/?envType=study-plan-v2&envId=top-interview-150

.geeksforgeeks.org/stringstream-c-applications/

do stack use kar liya tha lekin yeh ek stack me bhi ache se ho jata: https://leetcode.com/problems/simplify-path/solutions/1847
e=study-plan-v2&envId=top-interview-150

deta hu na bina likhetoh kuch bhi ese mistakes ho jaa rahe h


595195/c-python-7-simple-solutions-w-explanation-brute-force-dp-kadane-divide-conquer/?envType=study-plan-v2&envId=top-i

ze nikal ke minus kar raha tha uss chakkar me zada time lag gaya

ative-solution-with-two-binary-searches-with-explanation/?envType=study-plan-v2&envId=top-interview-150 . Toh iss solution ko


ade vali height ko hi dhundenge left side ke array me lower bound nikal ke

mplify-path/solutions/1847357/c-easy-stack-simple-explained-algorithm/?envType=study-plan-v2&envId=top-interview-150
study-plan-v2&envId=top-interview-150

w-150 . Toh iss solution ko dekh ke yeh learning mili h ki jab bhi esi situation ho jisme element ko find karne ke baad bhi apni s
vId=top-interview-150
karne ke baad bhi apni search nahi rukni chaiye toh ese case me apn fir kya karenge ki while(left<right) and jo arr[mid]==targe
ght) and jo arr[mid]==target vali chez h vo hata ke l ya right me mid ki value assign karte jaaenge!!!
Youtube
Instagram
100 Days Coding Chal
LinkedIn

LEARNING TRACKER
GOAL : To improve Problem Solving Skills by doing 250 Good DSA Questions

Day Link
ng Challenge
by Siddharth Singh

Good DSA Questions in 100 Days

You might also like