Sanjay (eNinja-in)
@eninjain
Followers
2
Following
456
Media
93
Statuses
94
Cybersecurity Enthusiast | Full stack Developer with DSA | Proficient in Python, C, C++ | GATE2025 (377) | Passionate Secure Web Solutions.
Joined June 2025
π’ #82 Remove Duplicates from Sorted List Remove all duplicates from a sorted linked list, keeping only distinct numbers. Use a dummy node, traverse & skip duplicates, link unique nodes. Input: 1->2->3->3->4->4->5 Output: 1->2->5 β
O(n) time, O(1) space. #LinkedList
0
0
0
π’ #81 Search in Rotated Sorted Array Find a target in a sorted array rotated at a pivot. π― Use modified binary search: check which half is sorted, then narrow search. Input: [4,5,6,7,0,1,2], target=0 β Output: 4 β
O(log n) time, O(1) space. #BinarySearch #LeetCodeMedium
0
0
0
π’ #80 Remove Duplicates from Sorted Array Clean a sorted array so each element appears once! β¨ Use two pointers to overwrite duplicates in-place. Example: [1,1,2,2,3] β [1,2,3], length = 3 β
Time: O(n), Space: O(1) #RemoveDuplicates #TwoPointers #LeetCodeEasy
0
0
0
π₯ Networking Cheat Sheet β Hacker Edition π₯ π§© OSI & TCP/IP: instant recall π IPs: IPv4/IPv6 & private ranges π Ports: FTP, SSH, DNS, HTTPS, RDP β οΈ π οΈ Commands: ping,traceroute,netstat,nmap,curl,dig π» π‘οΈ Security: firewall, IDS/IPS, VPN π π Attacks & β‘ Defenses
0
0
1
π’ #78 Subsets Generate the power set of an array π― Using DFS + Backtracking, at each step you either include β
or exclude β an element β every path = new subset π Ex: [1,2,3] β [], [1], [2], [3], [1,2], [1,3], [2,3], [1,2,3] β
β± O(2^nΒ·n) | π¦ O(n) #DFS #Backtracking
0
0
1
π’ #77 Combinations Given n & k, return all k-number combinations from 1..n. β‘ Use backtracking: build recursively, track current combo, add when size=k. π¦ Example: n=4, k=2 β [ [1,2],[1,3],[1,4],[2,3],[2,4],[3,4] ] #Combinations #Backtracking #LeetCodeMedium
0
0
1
π #76 Minimum Window Substring Find the smallest substring in s containing all chars of t. Use sliding window + char count array, expand right, shrink left to minimize. Ex: s='ADOBECODEBANC', t='ABC' β 'BANC' O(n+m) time, O(128) space #SlidingWindow #LeetCodeHard
0
0
1
π¨ #75 Sort Colors FAST! π₯ Array of 0οΈβ£,1οΈβ£,2οΈβ£? Sort IN-PLACE like a boss! Use Dutch National Flag 3-pointer magic: push 0s front, 2s back, 1s chill in the middle. π¨ One pass | O(n) | O(1) #SortColors #LeetCode #CodingHacks #ArrayMagic
0
0
0
#74 Search 2D Matrix Matrix sorted row-wise & first of each row > last of prev. Find target β
β‘ Trick: treat it as 1D β Binary Search! row=mid/n, col=mid%n β± O(log(mn)) | πΎ O(1) #Search2DMatrix #BinarySearch #LeetCodeMedium #InterviewReady
0
0
1
#73 Set Matrix Zeroes π¦ Given an mΓn matrix, if an element = 0 β set its row & col to 0. β‘ In-place, O(1) space: use 1st row/col as markers β mark, zero out, then fix 1st row/col. π Time: O(mn) | Space: O(1) #SetMatrixZeroes #LeetCodeMedium #InterviewReady
0
0
1
βοΈ #72 Edit Distance Find min ops to convert word1 β word2 using insert, delete, replace. DP: dp[i][j] = min steps for first i,j chars. If same: dp[i][j]=dp[i-1][j-1], else =1+min(insert,del,rep). Ex: horseβros =3 β
β± O(mn) πΎ O(mn) #EditDistance #DP #LeetCode
0
0
1
π£οΈ #71 Simplify Path Simplify a Unix-style absolute path. / separates dirs, . = current, .. = parent. Remove extra slashes. Ex: "/home/"β"/home", "/a/./b/../../c/"β"/c" β
β± O(n) | π¦ O(n) #SimplifyPath #StringParsing #LeetCodeMedium #UnixPaths #EdgeCases
0
0
2
πͺ #70 Climbing Stairs Count ways to climb n stairs taking 1 or 2 steps at a time. Classic Fibonacci problem. Ex: n=2β2 β
, n=3β3 β
β± O(n) | π¦ O(1) #ClimbingStairs #DP #Fibonacci #LeetCodeEasy #InterviewReady #MathAndSequences #EdgeCases
0
0
1
π #69 Sqrt(x) Compute the integer part of βx (truncate decimals) for non-negative x. Use binary search for efficiency and avoid overflow. Ex: x=4β2 β
, x=8β2 β
β± O(log x) | π¦ O(1) #Sqrtx #BinarySearch #LeetCodeEasy #MathAndBinary #EdgeCases
0
0
1
π #68 Text Justification Format words into lines of length maxWidth. β‘ Spread spaces evenly, put extra left, last line left-aligned. Ex: ["This","is","an","example","of","text","justification."],16 β ["This is an","example of text","justification. "] β
β±O(n) π¦O(n)
0
0
1
π» #67 Add Binary Add 2 binary strings a & b β return sum in binary. β‘ Only 0/1, handle carry & different lengths. β
"11"+"1"β"100" β
"1010"+"1011"β"10101" β± O(max(n,m)) | π¦ O(max(n,m)) #AddBinary #BinaryMath #LeetCodeEasy #InterviewReady #CarryOver
0
0
1
β¨β #66 Plus One β¨ Increment a number stored as an array of digits π’. β‘ Handles carry (9β10), no leading zeros (except 0). β
[1,2,3]β[1,2,4] β
[4,3,2,1]β[4,3,2,2] β
[9]β[1,0] β± O(n) | π¦ O(1) #PlusOne #ArrayMath #LeetCodeEasy #InterviewReady #EdgeCases
0
0
1
π’ #65 Valid Number Check if a string is a valid number: int, decimal, or scientific (e/E), with optional +/-. Ex: "0"β
"0.1"β
"abc"β "1e10"β
"e3"β π‘ Trim spaces, handle sign, split num & exponent, validate parts. β± O(n), π O(1). #StringParsing #LeetCodeHard
0
0
1
π€οΈ #64 Minimum Path Sum Find the min path sum in an mΓn grid, moving only β¬οΈ or β‘οΈ. Ex: [[1,3,1],[1,5,1],[4,2,1]] β 7 β
(path: 1β3β1β1β1) π‘ DP trick: dp[i][j] = grid[i][j] + min(top,left) β± O(mn), π O(mn)/O(n). #DynamicProgramming #LeetCodeMedium #InterviewReady
0
0
1