Skip to content

akankshakumari393/leetcode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

REAL LIFE USAGE FOR DATASTRUCTURE

Array: Seat of a Theatre represents an 2D array

StacK:

The browser history is stored in stack usually so we can go back to the last visited pages.

Singly Linked List:

In a music player, songs are connected, we play one song then we get the other song in the playlist automatically, that's because the songs are connected and we can consider them as nodes.

Doubly Linked List:

Sometime we would like to go back to the previous song played so that's where doubly Linked list comes in picture. From each of the song we can either go back or play the next song. .

Circular Linked List:

Sometime we would like the playlist to play the first song again once it finishes playing all or in simple terms repeat itself. That's where Circular linked list comes in picture.

Graph:

Google Map uses graph, each cities(nodes) are connected with some edges(path) that have some weight(distance). Google map uses graph algorithm to find the shortest path between two cities.

BST(Binary Search Tree):

It would take at worst n element to insert/delete an element from a sorted array. So we represent it using BST. So searching and Retrieval is mostly done using BST.

leetcode

Leetcode solutions(Golang)

1-two-sum
2-add-two-numbers
3-longest-substring-without-repeating-characters
4-median-of-two-sorted-arrays
5-longest-palindromic-substring
8-string-to-integer-atoi
9-palindrome-number
11-container-with-most-water
12-integer-to-roman
13-roman-to-integer
14-longest-common-prefix
15-3sum
19-remove-nth-node-from-end-of-list
20-valid-parentheses
21-merge-two-sorted-lists
26-remove-duplicates-from-sorted-array
27-remove-element
31-next-permutation
33-search-in-rotated-sorted-array
34-find-first-and-last-position-of-element-in-sorted-array
35-search-insert-position
36-valid-sudoku
39-combination-sum
46-permutations
48-rotate-image
49-group-anagrams
50-powx-n
53-maximum-subarray
56-merge-intervals
58-length-of-last-word
61-rotate-list
62-unique-paths
64-minimum-path-sum
66-plus-one
69-sqrtx
70-climbing-stairs
73-set-matrix-zeroes
74-search-a-2d-matrix
75-sort-colors
77-combinations
81-search-in-rotated-sorted-array-ii
83-remove-duplicates-from-sorted-list
88-merge-sorted-array
92-reverse-linked-list-ii
94-binary-tree-inorder-traversal
98-validate-binary-search-tree
100-same-tree
101-symmetric-tree
102-binary-tree-level-order-traversal
104-maximum-depth-of-binary-tree
105-construct-binary-tree-from-preorder-and-inorder-traversal
106-construct-binary-tree-from-inorder-and-postorder-traversal
108-convert-sorted-array-to-binary-search-tree
111-minimum-depth-of-binary-tree
118-pascals-triangle
119-pascals-triangle-ii
121-best-time-to-buy-and-sell-stock
125-valid-palindrome
128-longest-consecutive-sequence
130-surrounded-regions
133-clone-graph
136-single-number
138-copy-list-with-random-pointer
141-linked-list-cycle
142-linked-list-cycle-ii
144-binary-tree-preorder-traversal
145-binary-tree-postorder-traversal
153-find-minimum-in-rotated-sorted-array
160-intersection-of-two-linked-lists
162-find-peak-element
169-majority-element
199-binary-tree-right-side-view
200-number-of-islands
203-remove-linked-list-elements
206-reverse-linked-list
207-course-schedule
210-course-schedule-ii
217-contains-duplicate
219-contains-duplicate-ii
226-invert-binary-tree
229-majority-element-ii
234-palindrome-linked-list
235-lowest-common-ancestor-of-a-binary-search-tree
240-search-a-2d-matrix-ii
242-valid-anagram 278-first-bad-version
287-find-the-duplicate-number
289-game-of-life
300-longest-increasing-subsequence
328-odd-even-linked-list
344-reverse-string
350-intersection-of-two-arrays-ii
387-first-unique-character-in-a-string
410-split-array-largest-sum
461-hamming-distance
520-detect-capital
540-single-element-in-a-sorted-array
543-diameter-of-binary-tree
559-maximum-depth-of-n-ary-tree
566-reshape-the-matrix
576-out-of-boundary-paths
680-valid-palindrome-ii
637-average-of-levels-in-binary-tree
695-max-area-of-island
704-binary-search
705-design-hashset
729-my-calendar-i
746-min-cost-climbing-stairs
792-number-of-matching-subsequences
804-unique-morse-code-words
858-mirror-reflection
875-koko-eating-bananas
876-middle-of-the-linked-list
890-find-and-replace-pattern
895-maximum-frequency-stack
997-find-the-town-judge
1011-capacity-to-ship-packages-within-d-days
1283-find-the-smallest-divisor-given-a-threshold
1329-sort-the-matrix-diagonally
1448-count-good-nodes-in-binary-tree
1482-minimum-number-of-days-to-make-m-bouquets
1539-kth-missing-positive-number
1603-design-parking-system
1791-find-center-of-star-graph
2013-detect-squares
2296-design-a-text-editor
2351-first-letter-to-appear-twice