Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/akankshakumari393/leetcode
/ functions
Functions
210 in github.com/akankshakumari393/leetcode
⨍
Functions
210
◇
Types & classes
8
Function
findCombinations
Using Recursion
39-combination-sum/39-combination-sum.go:11
Function
findDuplicate
(nums []int)
287-find-the-duplicate-number/287-find-the-duplicate-number.go:1
Function
findJudge
(n int, trust [][]int)
997-find-the-town-judge/997-find-the-town-judge.go:1
Function
findKthPositive
Apply a binary search. Since the array is sorted we can find at any given index how many numbers are missing as arr[index] – (index+1)
1539-kth-missing-positive-number/1539-kth-missing-positive-number.go:2
Function
findMedianSortedArrays
(nums1 []int, nums2 []int)
4-median-of-two-sorted-arrays/4-median-of-two-sorted-arrays.go:1
Function
findMin
(nums []int)
153-find-minimum-in-rotated-sorted-array/153-find-minimum-in-rotated-sorted-array.go:1
Function
findOrder
(numCourses int, prerequisites [][]int)
210-course-schedule-ii/210-course-schedule-ii.go:1
Function
findPaths
(m int, n int, maxMove int, startRow int, startColumn int)
576-out-of-boundary-paths/576-out-of-boundary-paths.go:1
Function
findPeakElement
(nums []int)
162-find-peak-element/162-find-peak-element.go:1
Function
firstBadVersion
** * Forward declaration of isBadVersion API. * @param version your guess about first bad version * @return true if current version i
278-first-bad-version/278-first-bad-version.go:9
Function
firstUniqChar
Time Taken O(n)
387-first-unique-character-in-a-string/387-first-unique-character-in-a-string.go:2
Function
gameOfLife
(board [][]int)
289-game-of-life/289-game-of-life.go:1
Function
generate
Property of pascal triangle 1 1,1 1.2.1 1,3,3,1 first and last element of a row is 1 always the count of element in each row is rowNumber+1
118-pascals-triangle/118-pascals-triangle.go:12
Function
generateParenthesis
(n int)
22-generate-parentheses/22-generate-parentheses.go:1
Function
getIntersectionNode
** * Definition for singly-linked list. * type ListNode struct { * Val int * Next *ListNode * } */
160-intersection-of-two-linked-lists/160-intersection-of-two-linked-lists.go:8
Function
getRow
val = val * (rowIndex - j)/(j + 1) At rowIndex there are rowIndex + 1 elements
119-pascals-triangle-ii/119-pascals-triangle-ii.go:3
Function
goodNodes
(root *TreeNode)
1448-count-good-nodes-in-binary-tree/1448-count-good-nodes-in-binary-tree.go:21
Function
groupAnagrams
TimeComplexity - O(nk)
49-group-anagrams/49-group-anagrams.go:2
Function
hammingDistance
(x int, y int)
461-hamming-distance/461-hamming-distance.go:1
Function
hasCycle
** * Definition for singly-linked list. * type ListNode struct { * Val int * Next *ListNode * } */
141-linked-list-cycle/141-linked-list-cycle.go:8
Function
inorderTraversal
** * Definition for a binary tree node. * type TreeNode struct { * Val int * Left *TreeNode * Right *TreeNode * } */
94-binary-tree-inorder-traversal/94-binary-tree-inorder-traversal.go:9
Function
intToRoman
(num int)
12-integer-to-roman/12-integer-to-roman.go:1
Function
intersect
(nums1 []int, nums2 []int)
350-intersection-of-two-arrays-ii/350-intersection-of-two-arrays-ii.go:1
Function
invertTree
** * Definition for a binary tree node. * type TreeNode struct { * Val int * Left *TreeNode * Right *TreeNode * } */
226-invert-binary-tree/226-invert-binary-tree.go:9
Function
isAnagram
Time Complexity - O(n) Space Complexity - O(1)
242-valid-anagram/242-valid-anagram.go:3
Function
isPalindrome
** * Definition for singly-linked list. * type ListNode struct { * Val int * Next *ListNode * } */
234-palindrome-linked-list/234-palindrome-linked-list.go:8
Function
isPalindrome
(s string)
125-valid-palindrome/125-valid-palindrome.go:1
Function
isPalindrome
(x int)
9-palindrome-number/9-palindrome-number.go:1
Function
isSameTree
** * Definition for a binary tree node. * type TreeNode struct { * Val int * Left *TreeNode * Right *TreeNode * } */
100-same-tree/100-same-tree.go:9
Function
isSymmetric
** * Definition for a binary tree node. * type TreeNode struct { * Val int * Left *TreeNode * Right *TreeNode * } */
101-symmetric-tree/101-symmetric-tree.go:9
Function
isValid
(s string)
20-valid-parentheses/20-valid-parentheses.go:18
Function
isValidBST
** * Definition for a binary tree node. * type TreeNode struct { * Val int * Left *TreeNode * Right *TreeNode * } */
98-validate-binary-search-tree/98-validate-binary-search-tree.go:9
Function
isValidSudoku
Time Complexity O(n2)
36-valid-sudoku/36-valid-sudoku.go:2
Function
lengthOfLIS
(nums []int)
300-longest-increasing-subsequence/300-longest-increasing-subsequence.go:1
Function
lengthOfLastWord
(s string)
58-length-of-last-word/58-length-of-last-word.go:1
Function
lengthOfLongestSubstring
(s string)
3-longest-substring-without-repeating-characters/3-longest-substring-without-repeating-characters.go:1
Function
letterCombinations
(digits string)
17-letter-combinations-of-a-phone-number/17-letter-combinations-of-a-phone-number.go:12
Function
levelOrder
** * Definition for a binary tree node. * type TreeNode struct { * Val int * Left *TreeNode * Right *TreeNode * } */
102-binary-tree-level-order-traversal/102-binary-tree-level-order-traversal.go:9
Function
longestCommonPrefix
(strs []string)
14-longest-common-prefix/14-longest-common-prefix.go:1
Function
longestConsecutive
MakeMyTrip
128-longest-consecutive-sequence/128-longest-consecutive-sequence.go:2
Function
longestPalindrome
(s string)
5-longest-palindromic-substring/5-longest-palindromic-substring.go:1
Function
lowestCommonAncestor
** * Definition for a binary tree node. * type TreeNode struct { * Val int * Left *TreeNode * Right *TreeNode * } */
235-lowest-common-ancestor-of-a-binary-search-tree/235-lowest-common-ancestor-of-a-binary-search-tree.go:10
Function
majorityElement
(nums []int)
169-majority-element/169-majority-element.go:1
Function
majorityElement
(nums []int)
229-majority-element-ii/229-majority-element-ii.go:2
Function
matrixReshape
(mat [][]int, r int, c int)
566-reshape-the-matrix/566-reshape-the-matrix.go:1
Function
maxArea
(height []int)
11-container-with-most-water/11-container-with-most-water.go:1
Function
maxAreaOfIsland
(grid [][]int)
695-max-area-of-island/695-max-area-of-island.go:1
Function
maxDepth
** * Definition for a binary tree node. * type TreeNode struct { * Val int * Left *TreeNode * Right *TreeNode * } */
104-maximum-depth-of-binary-tree/104-maximum-depth-of-binary-tree.go:9
Function
maxDepth
** * Definition for a Node. * type Node struct { * Val int * Children []*Node * } */
559-maximum-depth-of-n-ary-tree/559-maximum-depth-of-n-ary-tree.go:9
Function
maxProfit
Brute Force approach -- Time limit exceeded Time complexity - O(n^2) Space complexity - O(1) Suppose Buying a stock at Ith day and selling it at jth d
121-best-time-to-buy-and-sell-stock/121-best-time-to-buy-and-sell-stock.go:55
Function
maxSubArray
(nums []int)
53-maximum-subarray/53-maximum-subarray.go:1
Function
merge
(nums1 []int, m int, nums2 []int, n int)
88-merge-sorted-array/88-merge-sorted-array.go:1
Function
merge
(intervals [][]int)
56-merge-intervals/56-merge-intervals.go:1
Function
mergeTwoLists
** * Definition for singly-linked list. * type ListNode struct { * Val int * Next *ListNode * } */
21-merge-two-sorted-lists/21-merge-two-sorted-lists.go:8
Function
middleNode
** * Definition for singly-linked list. * type ListNode struct { * Val int * Next *ListNode * } */
876-middle-of-the-linked-list/876-middle-of-the-linked-list.go:8
Function
minCostClimbingStairs
At any given position we need to find the minimum of previous two step TimeComplexity - O(n) Space complexity - O(1)
746-min-cost-climbing-stairs/746-min-cost-climbing-stairs.go:5
Function
minDays
maxDays - max of the bloomDay // minDays = min of bloomDay Time Complexity - log(max(bloomDay))
1482-minimum-number-of-days-to-make-m-bouquets/1482-minimum-number-of-days-to-make-m-bouquets.go:3
Function
minDepth
** * Definition for a binary tree node. * type TreeNode struct { * Val int * Left *TreeNode * Right *TreeNode * } */
111-minimum-depth-of-binary-tree/111-minimum-depth-of-binary-tree.go:9
Function
minEatingSpeed
(piles []int, h int)
875-koko-eating-bananas/875-koko-eating-bananas.go:1
Function
minPathSum
(grid [][]int)
64-minimum-path-sum/64-minimum-path-sum.go:1
Function
mirrorReflection
(p int, q int)
858-mirror-reflection/858-mirror-reflection.go:1
Function
myAtoi
(str string)
8-string-to-integer-atoi/8-string-to-integer-atoi.go:3
Function
myPow
binary Search
50-powx-n/50-powx-n.go:2
Function
mySqrt
(x int)
69-sqrtx/69-sqrtx.go:1
Function
nextPermutation
(nums []int)
31-next-permutation/31-next-permutation.go:1
Function
numIslands
(grid [][]byte)
200-number-of-islands/200-number-of-islands.go:1
Function
numMatchingSubseq
Using HashMap and Queue
792-number-of-matching-subsequences/792-number-of-matching-subsequences.go:2
Function
oddEvenList
** * Definition for singly-linked list. * type ListNode struct { * Val int * Next *ListNode * } */
328-odd-even-linked-list/328-odd-even-linked-list.go:8
Function
partition
(s string)
131-palindrome-partitioning/131-palindrome-partitioning.go:1
Function
permute
(nums []int)
46-permutations/46-permutations.go:1
Function
plusOne
(digits []int)
66-plus-one/66-plus-one.go:1
Function
postorderTraversal
** * Definition for a binary tree node. * type TreeNode struct { * Val int * Left *TreeNode * Right *TreeNode * } */
145-binary-tree-postorder-traversal/145-binary-tree-postorder-traversal.go:10
Function
powerset
func subsets(nums []int) [][]int { number of paranthesis left to be printed res := [][]int{} powerset(&res, []int{}, nums, 0) return res }
78-subsets/78-subsets.go:8
Function
preorderTraversal
(root *TreeNode)
144-binary-tree-preorder-traversal/144-binary-tree-preorder-traversal.go:1
Function
removeDuplicates
Two pointer Approach
26-remove-duplicates-from-sorted-array/26-remove-duplicates-from-sorted-array.go:2
Function
removeElement
two pointer approach
27-remove-element/27-remove-element.go:2
Function
removeElements
** * Definition for singly-linked list. * type ListNode struct { * Val int * Next *ListNode * } */
203-remove-linked-list-elements/203-remove-linked-list-elements.go:8
Function
removeNthFromEnd
** * Definition for singly-linked list. * type ListNode struct { * Val int * Next *ListNode * } */
19-remove-nth-node-from-end-of-list/19-remove-nth-node-from-end-of-list.go:8
Function
repeatedCharacter
(s string)
2351-first-letter-to-appear-twice/2351-first-letter-to-appear-twice.go:1
Function
reverseBetween
** * Definition for singly-linked list. * type ListNode struct { * Val int * Next *ListNode * } */
92-reverse-linked-list-ii/92-reverse-linked-list-ii.go:8
Function
reverseList
** * Definition for singly-linked list. * type ListNode struct { * Val int * Next *ListNode * } */ func reverseList(head *ListNode) *Lis
206-reverse-linked-list/206-reverse-linked-list.go:26
Function
reverseString
(s []byte)
344-reverse-string/344-reverse-string.go:1
Function
rightSideView
** * Definition for a binary tree node. * type TreeNode struct { * Val int * Left *TreeNode * Right *TreeNode * } */
199-binary-tree-right-side-view/199-binary-tree-right-side-view.go:9
Function
romanToInt
(s string)
13-roman-to-integer/13-roman-to-integer.go:1
Function
rotate
(matrix [][]int)
48-rotate-image/48-rotate-image.go:1
Function
rotateRight
** * Definition for singly-linked list. * type ListNode struct { * Val int * Next *ListNode * } */
61-rotate-list/61-rotate-list.go:8
Function
search
(nums []int, target int)
704-binary-search/704-binary-search.go:1
Function
search
(nums []int, target int)
81-search-in-rotated-sorted-array-ii/81-search-in-rotated-sorted-array-ii.go:1
Function
search
(nums []int, target int)
33-search-in-rotated-sorted-array/33-search-in-rotated-sorted-array.go:1
Function
searchInsert
(nums []int, target int)
35-search-insert-position/35-search-insert-position.go:1
Function
searchMatrix
Time Complexity O(m+n) Space Complexity O(1)
240-search-a-2d-matrix-ii/240-search-a-2d-matrix-ii.go:3
Function
searchMatrix
(matrix [][]int, target int)
74-search-a-2d-matrix/74-search-a-2d-matrix.go:1
Function
searchRange
(nums []int, target int)
34-find-first-and-last-position-of-element-in-sorted-array/34-find-first-and-last-position-of-element-in-sorted-array.go:1
Function
setZeroes
(matrix [][]int)
73-set-matrix-zeroes/73-set-matrix-zeroes.go:1
Function
shipWithinDays
Capacity must be >= 10 as max weight is 10. Cargo must to capable enough to take each weight individually. Now we got starting point. What should be o
1011-capacity-to-ship-packages-within-d-days/1011-capacity-to-ship-packages-within-d-days.go:5
Function
singleNonDuplicate
(nums []int)
540-single-element-in-a-sorted-array/540-single-element-in-a-sorted-array.go:1
Function
singleNumber
0^number = number number^number = 0
136-single-number/136-single-number.go:3
Function
smallestDivisor
max divisor is max of numbers, min divisor is 1
1283-find-the-smallest-divisor-given-a-threshold/1283-find-the-smallest-divisor-given-a-threshold.go:2
Function
solve
(board [][]byte)
130-surrounded-regions/130-surrounded-regions.go:1
Function
sortColors
(nums []int)
75-sort-colors/75-sort-colors.go:1
← previous
next →
101–200 of 210, ranked by callers