Darshan

337 posts

Darshan banner
Darshan

Darshan

@imDarshanGK

Python | Exploring Machine Learning | Open-Source Contributor | AI & Tech Enthusiast

Tumkur, India Katılım Haziran 2022
196 Takip Edilen27 Takipçiler
Darshan retweetledi
Ashish Pratap Singh
Ashish Pratap Singh@ashishps_1·
12 must-know data structures for coding interviews: 1. 𝐀𝐫𝐫𝐚𝐲𝐬 - A fixed-size collection of elements stored in contiguous memory. - Provides O(1) access based on index. 2. 𝐌𝐚𝐭𝐫𝐢𝐱 (2𝐃 𝐀𝐫𝐫𝐚𝐲) - A multi-dimensional array used for representing grids, graphs, and dynamic programming problems. 3. 𝐋𝐢𝐧𝐤𝐞𝐝 𝐋𝐢𝐬𝐭 - A dynamic data structure where elements (nodes) are linked via pointers. - Types: Singly Linked List, Doubly Linked List, Circular Linked List. 4. 𝐒𝐭𝐚𝐜𝐤 - A Last-In-First-Out (LIFO) data structure where the element added last is the first one to be removed. - Supports push, pop, and peek operations in O(1) time. 5. 𝐐𝐮𝐞𝐮𝐞 - A First-In-First-Out (FIFO) data structure. - Allows inserting at the back (enqueue) and removing from the front (dequeue) in O(1) time. - Used to process elements in the same order as they are added. 6. 𝐇𝐚𝐬𝐡𝐌𝐚𝐩 - A key-value data structure that uses a hash function for fast lookups. - Provides O(1) average-time insert/delete/search, O(N) (Worst-case due to collisions) 7. 𝐓𝐫𝐞𝐞 - A hierarchical data structure with a root node and child nodes. - Types: Binary Tree, N-ary Tree, AVL Tree, Red-Black Tree. 8. 𝐁𝐢𝐧𝐚𝐫𝐲 𝐒𝐞𝐚𝐫𝐜𝐡 𝐓𝐫𝐞𝐞 (𝐁𝐒𝐓) - A special tree where the left child < root < right child. - Enables O(log N) search, insert, and delete in balanced BSTs. 9. 𝐇𝐞𝐚𝐩 (𝐏𝐫𝐢𝐨𝐫𝐢𝐭𝐲 𝐐𝐮𝐞𝐮𝐞) - A binary tree-based structure where the parent is always greater (max heap) or smaller (min heap) than its children. - Provides O(log N) insert/delete and O(1) get min/max. 10. 𝐓𝐫𝐢𝐞 - A tree structure used for fast string searches. - Provides O(M) insert/search/delete, where M is the string length. 11. 𝐆𝐫𝐚𝐩𝐡 - A collection of nodes (vertices) connected by edges. - Represented using an Adjacency List (efficient) or Adjacency Matrix. - Types: Directed, Undirected, Weighted, Unweighted. 12. 𝐔𝐧𝐢𝐨𝐧-𝐅𝐢𝐧𝐝 (𝐃𝐢𝐬𝐣𝐨𝐢𝐧𝐭 𝐒𝐞𝐭) - A data structure used for efficiently handling dynamic connectivity. - Supports Union(x, y) and Find(x) in nearly O(1) time (with path compression). - Useful in detecting cycles and finding connected components in a graph. ♻️ Repost to help others in your network
Ashish Pratap Singh tweet media
English
7
163
946
29.4K
Darshan retweetledi
Ashish Pratap Singh
Ashish Pratap Singh@ashishps_1·
Git is easy (actually) once you learn these 20 commands: 1. 𝐠𝐢𝐭 𝐢𝐧𝐢𝐭: Initializes a new Git repository - Example: git init my-new-project 2. 𝐠𝐢𝐭 𝐜𝐨𝐧𝐟𝐢𝐠: Set git configuration values like username/email - Example: git config --global user .name "user123" 3. 𝐠𝐢𝐭 𝐜𝐥𝐨𝐧𝐞: Creates a copy of a remote repository - Example: git clone remote_url 4. 𝐠𝐢𝐭 𝐫𝐞𝐦𝐨𝐭𝐞: Manages connections to remote repositories - Example: git remote add origin remote_url 5. 𝐠𝐢𝐭 𝐬𝐭𝐚𝐭𝐮𝐬: Shows the current state of your working directory - Example: git status 6. 𝐠𝐢𝐭 𝐚𝐝𝐝: Adds files to the staging area - Example: git add file.js 7. 𝐠𝐢𝐭 𝐜𝐨𝐦𝐦𝐢𝐭: Record changes to local repository - Example: git commit -m "Fix navigation bug" 8. 𝐠𝐢𝐭 𝐩𝐮𝐬𝐡: Uploads local commits to a remote repository - Example: git push origin main 9. 𝐠𝐢𝐭 𝐩𝐮𝐥𝐥: Fetches and integrates changes from a remote repository - Example: git pull origin main 10. 𝐠𝐢𝐭 𝐟𝐞𝐭𝐜𝐡: Downloads latest changes from a remote repository without merging - Example: git fetch origin 11. 𝐠𝐢𝐭 𝐛𝐫𝐚𝐧𝐜𝐡: Lists, creates, or deletes branches - Example: git branch feature/login 12. 𝐠𝐢𝐭 𝐜𝐡𝐞𝐜𝐤𝐨𝐮𝐭: Switches branches or restores files - Example: git checkout feature/login 13. 𝐠𝐢𝐭 𝐦𝐞𝐫𝐠𝐞: Combines changes from different branches - Example: git merge feature/login 14. 𝐠𝐢𝐭 𝐫𝐞𝐛𝐚𝐬𝐞: Reapplies commits on top of another base - Example: git rebase main 15. 𝐠𝐢𝐭 𝐥𝐨𝐠: Shows commit history - Example: git log --oneline --graph 16. 𝐠𝐢𝐭 𝐝𝐢𝐟𝐟: Shows differences between commits, branches, etc. - Example: git diff HEAD~1 HEAD 17. 𝐠𝐢𝐭 𝐬𝐭𝐚𝐬𝐡: Temporarily stores uncommitted changes - Example: git stash save "WIP: feature implementation" 18. 𝐠𝐢𝐭 𝐫𝐞𝐬𝐞𝐭: Undoes changes by moving HEAD - Example: git reset --soft HEAD~1 19. 𝐠𝐢𝐭 𝐫𝐞𝐯𝐞𝐫𝐭: Creates a new commit that undoes a change - Example: git revert abc123f 20. 𝐠𝐢𝐭 𝐜𝐡𝐞𝐫𝐫𝐲-𝐩𝐢𝐜𝐤: Applies specific commit from another branch - Example: git cherry-pick abc123f What other git commands would you add to this list? ♻️ Repost to help others in your network
Ashish Pratap Singh tweet media
English
9
114
531
19.5K
Darshan retweetledi
Harshit Yadav
Harshit Yadav@HxrshitYadav·
These DSA topics are enough to clear most coding interviews. Core Data Structures: 1. Arrays & Strings (two pointers, prefix sums) 2. Hash Maps & Sets (frequency, lookup optimization) 3. Stack (monotonic stack, valid parentheses) 4. Queue & Deque (sliding window) 5. Linked Lists (reverse, cycle detection) Recursion & Trees: 6. Recursion basics & backtracking 7. Binary Trees (DFS, BFS) 8. Binary Search Trees (insert, delete, validate) 9. Tree Traversals (pre/in/post/level order) 10. Lowest Common Ancestor Searching & Sorting: 11. Binary Search (classic + variants) 12. Sorting algorithms (merge, quick, custom comparators) 13. Kth largest / Top K problems 14. Heap / Priority Queue usage Dynamic Programming: 15. 1D DP (climbing stairs, house robber) 16. 2D DP (grid paths, knapsack) 17. Subsequence / substring DP patterns Graphs & Advanced Patterns: 18. Graph Traversal (BFS, DFS, cycle detection) 19. Topological Sort (dependencies, scheduling) 20. Union-Find (connected components) If you can identify patterns, explain trade-offs, and code cleanly, most DSA parts stop being scary and start feeling repetitive.
English
11
72
518
23.2K
Darshan retweetledi
Miguel Ángel Durán
Miguel Ángel Durán@midudev·
Si quieres aprender Big O Notation esta es la mejor guía que existe, con ejemplos interactivos y diagramas. Hubiera pagado dinero por tener una explicación tan clara y sencilla en mis tiempos en la universidad: → samwho.dev/big-o/
Español
4
209
1.5K
64K
Darshan retweetledi
Ishan
Ishan@ishanxtwt·
we have covered the heavyweights (graphs, dp) and the tricky ones (strings) now let’s talk about the topic that feels easy until you get a NullPointerException Linked Lists interviewers love this topic because it exposes "lazy" coding you can't just access arr[i]. you have to navigate the pointers manually 250+ problems they all rely on 3 core patterns 1. Fast & Slow Pointers (Tortoise and Hare): the most famous pattern in dsa. use two pointers moving at different speeds (usually 1 step vs 2 steps) spot it: "detect cycle", "find middle of list", "palindrome linked list" why: if there is a loop, the fast pointer will eventually catch the slow one 2. In-Place Reversal: the classic "whiteboard" question. reversing a list (or part of it) without using extra memory spot it: "reverse linked list", "reverse nodes in k-group" why: you just need to track prev, curr, and next. change the arrow, move forward 3. The Two Pointer Merge: handling two lists at once. usually involves creating a "dummy" node to handle edge cases cleanly spot it: "merge two sorted lists", "intersection of two linked lists" why: eliminates the headache of writing if head is null twenty times linked lists are purely about pointer discipline always check if (curr.next != null) before moving 250+ problems → 3 patterns master these 3 patterns, and you will never fear a "segfault" again 6 topics down if you found this post helpful, I would really appreciate a repost so it may reach more ppl who need it let me know in the replies if you have any queries, locked in for topic 7
Ishan tweet media
English
15
34
216
7.4K
Darshan retweetledi
Vivo
Vivo@vivoplt·
LeetCode is HARD until you Learn these 15 Patterns: 1. Prefix Sum 2. Two Pointers 3. Sliding Window 4. Fast & Slow Pointers 5. LinkedList In-place Reversal 6. Monotonic Stack 7. Top ‘K’ Elements 8. Overlapping Intervals 9. Modified Binary Search 10. Binary Tree Traversal 11. Depth-First Search (DFS) 12. Breadth-First Search (BFS) 13. Matrix Traversal 14. Backtracking 15. Dynamic Programming Patterns
Vivo tweet media
English
51
336
2.3K
89.7K
Darshan retweetledi
Ashish Pratap Singh
Ashish Pratap Singh@ashishps_1·
7 must-know runtime complexities for coding interviews: 1. 𝐎(1) - 𝐂𝐨𝐧𝐬𝐭𝐚𝐧𝐭 𝐭𝐢𝐦𝐞 - The runtime doesn't change regardless of the input size. - Example: Accessing an element in an array by its index. 2. 𝐎(𝐥𝐨𝐠 𝐧) - 𝐋𝐨𝐠𝐚𝐫𝐢𝐭𝐡𝐦𝐢𝐜 𝐭𝐢𝐦𝐞 - The runtime grows slowly as the input size increases. Typically seen in algorithms that divide the problem in half with each step. - Example: Binary search in a sorted array. 3. 𝐎(𝐧) - 𝐋𝐢𝐧𝐞𝐚𝐫 𝐭𝐢𝐦𝐞 - The runtime grows linearly with the input size. - Example: Finding an element in an array by iterating through each element. 4. 𝐎(𝐧 𝐥𝐨𝐠 𝐧) - 𝐋𝐢𝐧𝐞𝐚𝐫𝐢𝐭𝐡𝐦𝐢𝐜 𝐭𝐢𝐦𝐞 - The runtime grows slightly faster than linear time. It involves a logarithmic number of operations for each element in the input. - Example: Sorting an array using quick sort or merge sort. 5. 𝐎(𝐧^2) - 𝐐𝐮𝐚𝐝𝐫𝐚𝐭𝐢𝐜 𝐭𝐢𝐦𝐞 - The runtime grows proportionally to the square of the input size. - Example: Bubble sort algorithm which compares and potentially swaps every pair of elements. 6. 𝐎(2^𝐧) - 𝐄𝐱𝐩𝐨𝐧𝐞𝐧𝐭𝐢𝐚𝐥 𝐭𝐢𝐦𝐞 - The runtime doubles with each addition to the input. These algorithms become impractical for larger input sizes. - Example: Generating all subsets of a set. 7. 𝐎(𝐧!) - 𝐅𝐚𝐜𝐭𝐨𝐫𝐢𝐚𝐥 𝐭𝐢𝐦𝐞 - Runtime is proportional to the factorial of the input size. - Example: Generating all permutations of a set. ♻️ Repost to help others in your network.
Ashish Pratap Singh tweet media
English
21
235
1.5K
62.3K
Shri💐🤗
Shri💐🤗@Shri_73_·
If you're into DSA .. let's connect!!
English
259
17
665
38.6K
Lokesh Singh Tanwar
Lokesh Singh Tanwar@Not_LokeshSingh·
Hii Guys If you're into DSA.. let's connect!!
English
41
1
83
2.4K