Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Appendix: Repo Coverage Index

Every file in src/main/kotlin/667 files — mapped to this book.

Legend: covered by a full page · variant of an alternative/duplicate implementation documented elsewhere · support a helper/non-problem file.

GenerateReadme.kt/ (1 files)

FileCoverage
GenerateReadme.ktsupport / non-problem

Main.kt/ (1 files)

FileCoverage
Main.ktsupport / non-problem

array/ (115 files)

FileCoverage
CheckkIfArrayIsSortedAndRotated.kt→ find minimum in rotated sorted array
ClosestSubsequenceSum.kt→ closest subsequence sum
Combinations.kt→ combinations
NextGreaterElement_III.kt→ next greater element ii
NextPermutation.kt→ next permutation
NextPermutationShorter.kt→ next permutation
PermutationHardFollowup.ktvariant of next permutation
Permutation_II.kt→ next permutation
Permutation_II_Backtracking.kt→ next permutation
Permutation_II_NarayanPandita.ktvariant of next permutation
Permutations.kt→ permutations
Subsets.kt→ partition to k equal sum subsets
Subsets_II.kt→ partition to k equal sum subsets
practice.ktsupport / non-problem
DiagonalTraverse.kt→ diagonal traverse
DiagonalTraverse_II.kt→ diagonal traverse
InsertInterval.kt→ insert interval
MergeIntervals.kt→ merge intervals
MergeSortedArray.kt→ merge sorted array
MissingRanges.kt→ first missing positive
MoveZeroes.kt→ move zeroes
RemoveElement.kt→ find peak element
RotateImage.kt→ rotate image
SearchA2dMatrix_II.kt→ search a 2d matrix
SetMatrixZeroes.kt→ set matrix zeroes
ShortestPathInBinaryMatrix.ktsupport / non-problem
SignOfTheProductOfAnArray.kt→ product of array except self
SpiralMatrix.kt→ spiral matrix
SpiralMatrix_II.kt→ spiral matrix
ToeplitzMatrix.kt→ search a 2d matrix
TransposeMatrix.kt→ search a 2d matrix
CombinationSum.kt→ combination sum
CombinationSum3.kt→ combination sum
CombinationSum_II.kt→ combination sum
NQueen.kt→ n-queens
FindTheDuplicateNumber.kt→ find the duplicate number
NestedListWeightedSum.kt→ flatten nested list iterator
BurstBallonsClean.ktvariant of minimum number of arrows to burst balloons
BurstBaloons.kt→ minimum number of arrows to burst balloons
CoinChange.kt→ coin change
CoinChangeBFS.kt→ coin change
CoinChangeBottomUp.kt→ coin change
CoinChange_II.kt→ coin change
CoinChange_II_BottomUp.kt→ coin change
HouseRobber.kt→ house robber
HouseRobber_II.kt→ house robber
KadensAlgorithm.kt→ maximum subarray (Kadane’s algorithm)
LongestCommonSubarray.kt→ longest common prefix
LongestIncreasingSequenceInAMatrix.kt→ longest consecutive sequence
LongestIncreasingSubsequence.kt→ longest increasing subsequence
MaximalSquare.kt→ maximal square
MaximumSumOfNonAdjacentElements.ktvariant of binary tree maximum path sum
MaximumSumSubArray.kt→ binary tree maximum path sum
MinCostClimbingStaris.kt→ min cost to connect all points
MinimumNumberofIncrementsSubarraysFormaTargetArray.ktvariant of find minimum in rotated sorted array
MinimumPathSum.kt→ binary tree maximum path sum
PartitionArrayIntoTwoArrayToMinimuzeSumDifference.ktvariant of partition equal subset sum
SplitArrayLargestSum.ktvariant of binary tree maximum path sum
StoneGame.kt→ jump game
TargetSum.kt→ binary tree maximum path sum
CanPlaceFlowers.kt→ can place flowers
ContainerWithMostWater.kt→ container with most water
IncreasingTripletSequence.ktvariant of longest consecutive sequence
KItemsWithMaximumSum.kt→ binary tree maximum path sum
MInimumNumberOfArrowsRequiredToBurstBallons.kt→ minimum number of arrows to burst balloons
MaximumDistanceInArray.ktvariant of binary tree maximum path sum
MaximumSwap.kt→ binary tree maximum path sum
MergeOverlappingIntervals.kt→ merge intervals
MinimumNumberOfTapsToWaterGarden.ktvariant of minimum number of arrows to burst balloons
MinimumNumberofSwapstoMaketheStringBalanced.kt→ minimum number of swaps to make the string balanced
NonOverlappingIntervals.kt→ non-overlapping intervals
ContainsDuplicate_II.kt→ contains duplicate ii
DegreeOfAnArray.kt→ find minimum in rotated sorted array
DivideArrayIntoEqualPairs.ktvariant of find minimum in rotated sorted array
EqualRowAndColumnPairs.kt→ equal row and column pairs
FindDifferenceOfTwoArrays.kt→ median of two sorted arrays
FindMissingPositive.kt→ first missing positive
FirstMissingPositive.kt→ first missing positive
IntegerToEnglishWords.ktvariant of count words with a given prefix
LongestConsecutiveSequence.kt→ longest consecutive sequence
MaxNUmWithKSumPairs.ktvariant of max consecutive ones iii
NumberOfGoodPairs.ktvariant of find the duplicate number
RankTransformOfAnArray.ktvariant of find minimum in rotated sorted array
SetMismatch.kt→ set matrix zeroes
SnapshotArray.kt→ find minimum in rotated sorted array
UniqueNumberOfOccurences.ktvariant of find the duplicate number
ValidSudoku.kt→ valid sudoku
2DPrefixSumImmutable.ktvariant of binary tree maximum path sum
ContiguousArray.kt→ find minimum in rotated sorted array
ContinuousSubarraySum.kt→ minimum size subarray sum
FIndTheHighestAltitute.ktvariant of find first and last position of target
FindPivotIndex.kt→ find the index of the first occurrence (kmp)
Minimum NumberofOperationstoMoveAllBallstoEachBox.kt→ minimum operations to move all balls
NumberOfZeroFilledSubArrays.kt→ number of zero-filled subarrays
ProductOfArrayExceptSelf.kt→ product of array except self
SubArrayProductLessThanK.kt→ product of array except self
SubArraySumEqualsToK.kt→ subarray sum equals k
SubArraySumsDivisibleByK.kt→ subarray sums divisible by k
ZeroArrayTransformation_I.ktvariant of find minimum in rotated sorted array
RandomPickIndex.kt→ random pick with weight
MeetingScheduler.kt→ meeting rooms
SortColors.kt→ sort colors
SquaresOfASortedArray.ktvariant of find minimum in rotated sorted array
MaximumPopulationYear.ktvariant of binary tree maximum path sum
4Sum.kt→ binary tree maximum path sum
IntervalListIntersection.ktvariant of flatten nested list iterator
LongestMountainInArray.kt→ peak index in a mountain array
NumberOfArithmaticTriplet.ktvariant of find the duplicate number
RemoveDuplicateElementsFromSortedArray.ktvariant of contains duplicate ii
RemoveDuplicateElementsFromSortedArray_II.ktvariant of contains duplicate ii
RotateArray.kt→ find minimum in rotated sorted array
ThreeSum.kt→ three sum
ThreeSumClosest.kt→ closest subsequence sum
TrappingRainWater.kt→ trapping rain water
TwoSum_II.kt→ two sum

autopilot/ (1 files)

FileCoverage
H1bAutoPilotStressAnxietyAlgorithm.ktsupport / non-problem

backtracking/ (12 files)

FileCoverage
ExpressionAndAddOperators.ktvariant of add two numbers
ExpressionAndAddOperatorsOptimized.ktvariant of add two numbers
NQueen.kt→ n-queens
NQueenOptimized.ktvariant of n-queens (optimized)
NQueen_II.kt→ n-queens ii
PalindromePartitioning.kt→ palindrome partitioning
PartitionToKEqualSumSubsets.kt→ partition to k equal sum subsets
PathWithMaximumGold.kt→ binary tree maximum path sum
RestoreIPAddresses.kt→ restore ip addresses
Strobogrammatic_Number_II.kt→ find the duplicate number
SudokuSolver.kt→ sudoku solver
SudokuSolverSet.kt→ sudoku solver

binarysearch/ (22 files)

FileCoverage
ApartmentHunting.kt→ apartment hunting
CapacityToShipPackageWithinDDays.kt→ capacity to ship packages within d days
ClosestSebsequenceSum.kt→ closest subsequence sum
FindFirstAndLastPosition.kt→ find first and last position of target
FindKClosestElements.kt→ find k closest elements
FindMinimumInRotatedSortedArray.kt→ find minimum in rotated sorted array
FindPeakElement.kt→ find peak element
FindPeakElementBetterSolution.kt→ find peak element
FirstBadVersion.kt→ first bad version
GuessNumberHigherOrLower.kt→ guess number higher or lower
HouseRobber_IV.kt→ house robber
KThMissingPositiveNumber.kt→ kth missing positive number
KokoEatingBanana.kt→ koko eating bananas
MedianOfTwoSortedARrays.kt→ median of two sorted arrays
PeakIndexInMountainArray.kt→ peak index in a mountain array
RandomPickWithWeight.kt→ random pick with weight
SearchA2dMatrix.kt→ search a 2d matrix
SearchInRotatedArray_II.kt→ search in rotated sorted array
SearchInRotatedSortedArray.kt→ search in rotated sorted array
SearchInsertionPosition.kt→ search insert position
SingleElementInASortedArray.kt→ single element in a sorted array
ValleyElement.kt→ valley element

bitset/ (10 files)

FileCoverage
FirstLetterToAppearTwice.ktvariant of find first and last position of target
LongestNiceSubarray.ktvariant of longest common prefix
MaximumXorOfTwoNumsInArray.kt→ maximum xor of two numbers
Number of Steps to ReduceaANumberInBinaryRepresentationtoOne.kt→ number of steps to reduce a number in binary
NumberOfOneBits.kt→ number of 1 bits
ReverseBits.kt→ reverse bits
SingleNumber.kt→ single number
SingleNumber3.kt→ single element in a sorted array
SmallestNumberWithAllSetBits.kt→ smallest number with all set bits
SumOfAllSubsetXorTotal.kt→ sum of all subset xor totals

cache/ (11 files)

FileCoverage
LFUCache.kt→ lfu cache
LFUCacheGigaCHAD.ktvariant of lfu cache
LRUCache.kt→ lru cache
LRUCacheBetter.ktvariant of lru cache
LRUCacheLinkedList.kt→ linked list cycle
LRUCleanAf.ktvariant of lru cache
LfuCacheNobodyDoesItBetter.ktvariant of lfu cache
LruCacheBruceLee.kt→ lru cache
LruCacheFuckYeah.kt→ lru cache
LruCacheNobodyDoesItBetter.ktvariant of lru cache
ThreadSafeLruCache.kt→ thread-safe sharded lru

commons/ (3 files)

FileCoverage
APIEndPoints.ktsupport / non-problem
AlpacaWebSocketFactory.ktsupport / non-problem
FileWriter.ktsupport / non-problem

design/ (2 files)

FileCoverage
PeekingIterator.kt→ peeking iterator
SelfDoubtSimulation.ktsupport / non-problem

disjointset/ (7 files)

FileCoverage
AccountMerge.kt→ merge intervals
DynamicConnectivity.kt→ dynamic connectivity
NumberOfIsland_II.kt→ find the duplicate number
NumerOfIsland_II_Optimized.kt→ max area of island
PowerGridMaintainance.ktsupport / non-problem
TheEarliestMomentEveryoneBecameFriends.kt→ the earliest moment everyone became friends
UnionFind.kt→ find first and last position of target

dynamic_programming/ (12 files)

FileCoverage
01Knapsack.kt→ 0/1 knapsack
ClosestSubsequenceSum.kt→ closest subsequence sum
FrogJump.kt→ frog jump
FrogJumpTopDown.kt→ frog jump
MaximumProductSubarray.kt→ maximum product subarray
MaximumProfitInJobScheduling.kt→ maximum profit in job scheduling
MinimumCostToCutAStick.kt→ minimum cost to cut a stick
MinimumCostToMergeStones.kt→ minimum cost to merge stones
MinimumCostToMergeStones_Intuition.kt→ minimum cost to merge stones
PartitionEqualSubsetSum.kt→ partition equal subset sum
SuperEggDropping.kt→ super egg drop
UnboundedKnapsack.kt→ unbounded knapsack

facebook/ (2 files)

FileCoverage
FindMinimumTicketPrice.kt→ find minimum in rotated sorted array
SecondGreatestNumber.ktsupport / non-problem

geo/ (4 files)

FileCoverage
KDTreeExample.kt→ kd-tree
ConstructQuadTree.kt→ construct tree from preorder and inorder
QuadTree.kt→ binary tree inorder traversal (iterative)
QuadTreeUsagePlaceFinding.ktsupport / non-problem

google/ (14 files)

FileCoverage
CountNumberOfWaysToPickKCoinsSumDivisibleByM.kt→ count ways to pick k coins divisible by m
CourseWithSemesterConstraint.ktvariant of course schedule ii
GoogleCheatSeetDeepSeekDeekThinkEdition.ktsupport / non-problem
GoogleCheatSheat.ktsupport / non-problem
GoogleCheatSheet_II.ktsupport / non-problem
GoogleCheatSheet_III.ktsupport / non-problem
GoogleCheatSheet_IV.ktsupport / non-problem
GooglrCheatSheetGraphEdition.ktsupport / non-problem
HandsOnCollectionsPLayground.ktsupport / non-problem
LargestSquareAreaInMatrix.ktvariant of kth largest element
MInDifferenceBetweenTotalSums.ktvariant of min cost to connect all points
MinimumTimeToFinishBuildByKWorkers.kt→ minimum time to collect all apples
ShuffleWithRandomness.kt→ shuffle an array
SongShuffle.kt→ shuffle an array

graph/ (77 files)

FileCoverage
BusRoutes.kt→ reorder routes to city zero
CalculateGraphDiameter.ktvariant of clone graph
ChromaticNumber.kt→ find the duplicate number
ChromaticNumberOptimized.ktvariant of find the duplicate number
CloneGraph.kt→ clone graph
CourseSchedule_II_Idiomatic.kt→ course schedule ii
DiameterOfBinaryTree.kt→ diameter of binary tree
EvalualteDivisions.kt→ evaluate division
HouseRobber3.kt→ house robber
IsBipartileBFSFunctional.ktvariant of is graph bipartite (BFS functional version)
IsBipartileGraph.kt→ clone graph
IsBipartileGraphDfs.ktvariant of clone graph
LargeScaleCourseSchedule.kt→ course schedule ii
MaximumPathQualityOfAGraph.kt→ binary tree maximum path sum
MinimumGeneticMutations.ktvariant of find minimum in rotated sorted array
NColoringGraph.kt→ clone graph
NColoringGreedy.kt→ n-coloring greedy
ParallelCourses_II_FunctionalProgramming.ktsupport / non-problem
ReorderRoutesToMakeAllPathsLeadToCityZero.ktsupport / non-problem
WordLadder.kt→ word ladder
WordLadder_II.kt→ word ladder
WordLadder_II_FinalCutPro.ktvariant of word ladder
WordLadder_II_clean.kt→ word ladder
CriticalConnectionsInANetwork.kt→ critical connections in a network
CriticalConnectionsInANetworkShortCode.ktvariant of critical connections in a network
FindArticulationPoints.ktvariant of count rectangles formed by points
BinarySearchTreeToGreaterSumTree.kt→ binary tree maximum path sum
RangeSumOfBST.ktvariant of binary tree maximum path sum
FindConnectedComponents.kt→ strongly connected components
BFSCycleDetection.ktvariant of course schedule ii (Kahn’s BFS cycle detection)
CourseSchedule.kt→ course schedule ii
CourseSchedule_II.kt→ course schedule ii
FindLengthOfLongestCycle.ktvariant of find first and last position of target
ParallelCourses.ktsupport / non-problem
BellmanFordAlgorithm.kt→ bellman-ford
CheapestFlightsWithinKStops.kt→ cheapest flights with k stops
CheapestFlightsWithinKStopsBellman.kt→ cheapest flights with k stops
FloydWarshallAlgorithm.kt→ floyd-warshall
MaximumVacationDays.ktvariant of binary tree maximum path sum
ParallelCourses_II.ktsupport / non-problem
ParallelCourses_II_Recursive.ktsupport / non-problem
SocialNetworkOperations.ktvariant of critical connections in a network
CrackingTheSafe.kt→ find peak element (safe boundaries)
FindEulerianCircuit.ktvariant of find first and last position of target
Theory.ktsupport / non-problem
ReconstructItenary.kt→ reconstruct itinerary
ValidArrangementOfPairs.ktvariant of longest valid parentheses
ValidArrangementOfPairsRecursive.ktvariant of longest valid parentheses
BipartileMatching.kt→ maximum bipartite matching
EdmondsKarp.kt→ max flow (edmonds-karp)
EdmondsKarpAdjacencyList.kt→ max flow (edmonds-karp)
EdmondsKarpAnother.kt→ max flow (edmonds-karp)
EdmondsKarpImpovised.kt→ max flow (edmonds-karp)
MaxFlowEdmondsKarp.kt→ max flow (edmonds-karp)
MaximumBipartileJobMatching.kt→ maximum bipartite matching
CheapestFlightWithKStops.ktvariant of cheapest flights with k stops
CheapestFlightsWithKStops.kt→ cheapest flights with k stops
DonaldTrumpAlgorithm.ktsupport / non-problem
NetworkDelayTime.kt→ network delay time
TheMaze_III.kt→ max consecutive ones iii
FindRedundentConnections.ktvariant of critical connections in a network
OptimizeWaterDistributionInAVillage.ktvariant of container with most water
PrimsAlgorithm.kt→ min cost to connect all points (prim’s)
PrimsShorter.kt→ min cost to connect all points (prim’s)
Kosaraju.ktvariant of strongly connected components (Kosaraju’s algorithm)
Tarjans.ktvariant of strongly connected components (Tarjan’s algorithm)
AlienDictionary.kt→ alien dictionary
AlienDictionary_BFS.kt→ alien dictionary
ApplySubstitutions.kt→ apply substitutions
CourseSchedule_II.kt→ course schedule ii
CourseSchedule_II_BFS.kt→ course schedule ii
ProteinFolding.ktsupport / non-problem
ShortestPathVisitingAllNodes.ktsupport / non-problem
TSPHelpKarp.kt→ find the index of the first occurrence (rabin-karp)
TravellingSalesPersonTopDownDP.ktvariant of travelling salesman (held-karp) (top-down DP)
TravellingSalesmanRecursiveDP.kt→ travelling salesman (held-karp)
TravellingSalespersonProblemBruteforceMatrix.ktvariant of travelling salesman (held-karp) (brute force)

greedy/ (17 files)

FileCoverage
CarFleet.kt→ car fleet
DestroyingAsteroids.kt→ destroying asteroids
JumpGame.kt→ jump game
JumpGame_II.kt→ jump game
MInimumCostHomecomingOfARobot.kt→ minimum cost to cut a stick
MaxChuncksToMakeSorted_II.ktvariant of max consecutive ones iii
MaxProfiAssigningWork.ktvariant of max consecutive ones iii
MaximumValueOfAnOrderedTriplet_II.ktvariant of binary tree maximum path sum
MeetingRooms.kt→ meeting rooms
MeetingRooms_II.kt→ meeting rooms
MeetingRooms_II_greedy.kt→ meeting rooms
MinimumDeletionsToMakeStringBalanced.kt→ minimum deletions to make string balanced
MinimumNumberOfRefuelingStops.kt→ minimum number of refueling stops
MinimumReplacementToSortTheArray.kt→ find minimum in rotated sorted array
MinimumTimeToMakeRopeColorful.kt→ minimum time to make rope colorful
RescheduleMeetingsforMaximumFreeTime_I.kt→ reschedule meetings for maximum free time
TaskScheduler.kt→ task scheduler

grid/ (22 files)

FileCoverage
FloodFill.kt→ flood fill
IslandPerimeter.kt→ island perimeter
MakingALargeIsland.kt→ making a large island
MakingALargeIsland_AnotherApproach.kt→ making a large island
MaxAreaOfIsland.ktvariant of max consecutive ones iii
MaximumNumberOfFishInAGrid.ktvariant of binary tree maximum path sum
PacificAtlanticWaterFlow.ktvariant of container with most water
RottingOranges.kt→ rotting oranges
ShortestBridge.ktsupport / non-problem
ShortestDistanceFromAllBuildings.ktsupport / non-problem
SurroundedRegion.kt→ surrounded regions
SurroundedRegionDfs.ktvariant of pattern primer: dfs with an undo button
TrappingRainwater_II.kt→ trapping rain water
WallsAndGates.kt→ walls and gates
ShortestPathInGridWithObstaclesElimination.ktsupport / non-problem
CherryPickup.kt→ cherry pickup
CherryPickup_II.kt→ cherry pickup
Test.ktsupport / non-problem
UniquePaths_I.kt→ first unique character
UniquePaths_II.kt→ first unique character
MaximalRectangle.kt→ largest rectangle in histogram
WordSearch_II.kt→ design add and search words

hashtable/ (12 files)

FileCoverage
CountNumberOfBadPairs.ktvariant of count rectangles formed by points
DesignANumberContainerSystem.kt→ design auto complete system
DesignFileSystem.kt→ design auto complete system
DesignHashMap.ktvariant of design a stack with increment operations
FirstUniqueCharacter.kt→ first unique character
HIndex.kt→ h-index
IntegerToRoman.kt→ roman to integer
IntersectionOfTwoArray.kt→ pattern primer: two pointers & the sorted-array dance
MaximumFrequencyStack.ktvariant of binary tree maximum path sum
RomanToInteger.kt→ roman to integer
WorkBreak_II.kt→ word break
WorlBreak_I_DP.kt→ word break

heap/ (12 files)

FileCoverage
DualBalancedHeap.ktvariant of find median from data stream (dual-heap structure)
FindKClosestElements.kt→ find k closest elements
FindScoreOfAnArrayAfterMarkingAllElements.ktvariant of find k closest elements
FindingMKAverage.kt→ finding mk average
IPO.kt→ ipo (maximize capital)
LongestHappyString.ktvariant of decode string
MedianFromRunningStream.kt→ find median from data stream
MeetingRoom_III.kt→ meeting rooms iii
SingleThreadedCPU.kt→ single threaded cpu
SlidingWindowMedian.kt→ sliding window median
TopKFrequentElements.kt→ top k frequent elements
TrappingRainWater_II.kt→ trapping rain water

linkedlist/ (23 files)

FileCoverage
AddTwoNumbers.kt→ add two numbers
CopyLinkedListWithRandomPointer.ktvariant of linked list cycle
DeleteMiddleNodeOfLinkedList.ktvariant of linked list cycle
InsertIntoASortedCircularLinkedList.ktvariant of linked list cycle
InsertIntoASortedCircularList.ktvariant of flatten nested list iterator
IntersectionOfTwoLinkedList.kt→ linked list cycle
LinkedListCycle.kt→ linked list cycle
LinkedListCycle_II.kt→ linked list cycle
MaximumTwinSumOfALinkedList.ktvariant of binary tree maximum path sum
MergeKSortedList.kt→ merge k sorted lists (divide & conquer, top-down)
MergeKSortedListHeap.kt→ merge k sorted lists (heap merge)
MergeKSortedListIterative.kt→ merge k sorted lists (divide & conquer, bottom-up)
MergeTwoSortedLIst.kt→ merge two sorted lists
MiddleNode.kt→ remove nth node from end
OddEvenLinkedList.kt→ linked list cycle
OddOrEvenLinkedList.kt→ linked list cycle
PalindromeLinkedList.kt→ linked list cycle
RemoveNthNodeFromEndOfList.kt→ remove nth node from end
ReverseLinkedList.kt→ reverse linked list
ReverseLinkedListIterative.kt→ reverse linked list
ReverseNodesInKGroups.ktvariant of evaluate reverse polish notation
RotateList.kt→ flatten nested list iterator
SwapNodesInPairs.ktvariant of shortest path visiting all nodes

math/ (36 files)

FileCoverage
AddStrings.kt→ add two numbers
DesignTicTacToe.ktvariant of design a stack with increment operations
DetectSquares.kt→ word squares
DivideTwoIntegers.ktvariant of add two numbers
HappyNumber.kt→ find the duplicate number
MinimumMovesToEqualArrayElements.kt→ find minimum in rotated sorted array
MultiplyStrings.kt→ isomorphic strings
PlusOne.kt→ plus one
PowerOfTwo.ktsupport / non-problem
ReverseInteger.kt→ evaluate reverse polish notation
SlidingPuzzle.kt→ sliding window maximum
Sqrt.ktvariant of sqrt(x)
StringtoIntegerAtoi.ktvariant of roman to integer
AddBinary.kt→ add two numbers
PascalsTriangle.kt→ pascal’s triangle
CheckIfTwoLinesIntrsects.ktvariant of add two numbers
ConvexHull.kt→ convex hull (erect the fence)
CountNumberOfTrapizoids_I.ktvariant of count rectangles formed by points
ErectTheFence_ConvexHull.kt→ convex hull (erect the fence)
HowManyRectanglesOverlapSweepLine.kt→ how many rectangles overlap
HowManyRectanglesOverlaping.ktvariant of count rectangles formed by points
MaxPointsOnALine.ktvariant of count rectangles formed by points
RectangleArea.kt→ largest rectangle in histogram
RectangleArea_II.kt→ largest rectangle in histogram
RectangleArea_II_SegmentTree.ktvariant of binary tree inorder traversal (iterative)
RectangleOverlap.kt→ largest rectangle in histogram
SeperateSquares_I.kt→ word squares
FindingNumberOfVisibleMountains.ktvariant of find the duplicate number
HowManyRectangleOverlapsIntervalTree.kt→ how many rectangles overlap
RectangeOverlapCountTreeSet.kt→ how many rectangles overlap
pow.ktsupport / non-problem
BasicCalculator.kt→ basic calculator ii
BasicCalculator_I.kt→ basic calculator ii
BasicCalculator_II.kt→ basic calculator ii
BasicCalculator_III.ktvariant of max consecutive ones iii
BasicCalculator_II_ShortCode.kt→ basic calculator ii

microsoft/ (3 files)

FileCoverage
Demo.ktsupport / non-problem
Toast.ktsupport / non-problem
ValidTime.ktsupport / non-problem

ml/ (1 files)

FileCoverage
DecisionTree.ktsupport / non-problem

numbers/ (1 files)

FileCoverage
PalindromeNumber.kt→ find the duplicate number

probability/ (5 files)

FileCoverage
InsertDeleteGetRandom.kt→ insert delete getrandom o(1)
InsertDeleteGetRandomAtO1.kt→ insert delete getrandom o(1)
LinkedListRandomNode.kt→ linked list cycle
PathWithMaximumProbability.kt→ binary tree maximum path sum
ReservoirSampling.kt→ weighted reservoir sampling

queueu/ (4 files)

FileCoverage
DesignACircularQueue.ktvariant of design a stack with increment operations
DesignHitCounter.ktvariant of design a stack with increment operations
NumberOfRecentCalls.ktvariant of find the duplicate number
ProductOfLastKNumbers.ktvariant of find first and last position of target

quicksort/ (6 files)

FileCoverage
DualPivotQuickSelect.kt→ top k frequent elements (quickselect)
GenericRanrmoizedQuickSelect.kt→ top k frequent elements (quickselect)
KClosestPointsToOrigin.kt→ k closest points to origin
KThLargestElementInArray.kt→ kth largest element
KthLargestElementInArrayTailRec.kt→ kth largest element
TopKFrequentElements.kt→ top k frequent elements

real_word_projects/ (18 files)

FileCoverage
HttpApiCall.ktsupport / non-problem
InterfaceExample.ktsupport / non-problem
ParallelFibonacci.ktsupport / non-problem
ScaleTransactions.ktsupport / non-problem
SystemInterviewHack.ktsupport / non-problem
TradingAPICallExample.ktsupport / non-problem
DataModels.ktsupport / non-problem
ChannelsExample.ktsupport / non-problem
SimpleThreadPool.ktsupport / non-problem
ConsistentHashing.ktsupport / non-problem
AiTest.ktsupport / non-problem
DuckworthLewisStern.ktsupport / non-problem
JsonExample.ktsupport / non-problem
CheckIfIPBelongsToNetworkAddress.ktvariant of critical connections in a network
FindMaxInArray.kt→ find minimum in rotated sorted array
ParallelMatrixMultiplication.ktsupport / non-problem
AlpacaSDKExamples.ktsupport / non-problem
RealtimeMarketDataStreaming.ktvariant of find median from data stream

simulation/ (7 files)

FileCoverage
CarPooling.kt→ car fleet
CountCollisionsOnARoad.ktvariant of count rectangles formed by points
FindWinnerOnATicTacToeGame.kt→ find winner on a tictactoe game
LatestTimeToCatchBus.ktsupport / non-problem
Racecar.kt→ racecar
RobotBoundedInCircle.kt→ robot bounded in circle
TextJustification.kt→ text justification

sliding_window/ (14 files)

FileCoverage
LongestContinuousSubarrayWithAbsoluteDifferenceLessThanOrEqualToLimit.ktvariant of longest common prefix
LongestRepeatingCharacterReplacement.kt→ longest repeating character replacement
LongestSubArraysOfOneAfterDeletingOneElement.kt→ longest subarray of 1s after deleting one
LongestSubstringWithoutRepeatingCharacter.kt→ longest repeating character replacement
MaxConsecutiveOnes_III.kt→ max consecutive ones iii
MaximumAverageSubarray_I.kt→ maximum average subarray i
MaximumErasureValue.ktvariant of binary tree maximum path sum
MaximumSumOfDistinctSubarraysWithLengthK.ktvariant of binary tree maximum path sum
MinimumSizeSubarraySum.kt→ minimum size subarray sum
MinimumSwapsToGroupAllOnesTogether.kt→ minimum operations to move all balls
MinimumWindowSubstring.kt→ minimum window substring
PartitionLabels.kt→ partition equal subset sum
ProgrammerString.kt→ decode string
SlidingWindowMaximum.kt→ sliding window maximum

sorting/ (6 files)

FileCoverage
EmployeeFreeTime.ktvariant of best time to buy and sell stock ii
HIndex.kt→ h-index
LargestNumber.kt→ largest number
MergeSort.kt→ merge sort
RankTeamsByVote.kt→ rank teams by votes
RussianDollEnvelope.kt→ russian doll envelopes

speed_dating/ (1 files)

FileCoverage
ComputerScienceEngineerDating.ktsupport / non-problem

stack/ (27 files)

FileCoverage
AestroidCollisions.kt→ asteroid collision
BuildingsWithAnOceanView.ktvariant of binary tree right side view
DailyTemperatures.kt→ daily temperatures
DesignAStackWithIncrementOperations.kt→ design a stack with increment operations
EvaluateReversePolishNotation.kt→ evaluate reverse polish notation
ExclusiveTimeOfFunctions.ktvariant of best time to buy and sell stock ii
FlattenNestedListIterator.kt→ flatten nested list iterator
LargestRectangleInHistogram.kt→ largest rectangle in histogram
LongestValidParanthesis.kt→ longest valid parentheses
MinStack.kt→ min stack
MinStackShort.kt→ min stack
MinimumAddtoMakeParenthesesValid.ktvariant of longest valid parentheses
MinimumDeletionsToMakeStringBalanced.kt→ minimum deletions to make string balanced
MinimumOperationstoConvertAllElementstoZero.kt→ minimum operations to convert all elements to zero
MinimumRemoveToMakeValidParentheses.ktvariant of longest valid parentheses
NextGreaterElement_I.kt→ next greater element ii
NextGreaterElement_II.kt→ next greater element ii
NumberOfVisiblePeopleInAQueue.ktvariant of find the duplicate number
OneThreeTwoPattern.kt→ pattern primer: o(1) lookup, three moves
OnlineStockSpan.ktvariant of best time to buy and sell stock ii
RemoveDuplicateLetters.ktvariant of contains duplicate ii
RemoveKDigits.kt→ remove k digits
RemoveStarsFromString.ktvariant of decode string
SmallestSubsequenceOfDistinctCharacters.ktvariant of closest subsequence sum
SumOfSubArrayMinimum.kt→ find minimum in rotated sorted array
SumOfSubArrayRanges.ktvariant of binary tree maximum path sum
ValidParentheses.kt→ longest valid parentheses

stock_market/ (5 files)

FileCoverage
BestTimeToBuyAndSellStock.kt→ best time to buy and sell stock ii
BestTimeToBuyAndSellStockWithCooldown.kt→ best time to buy and sell stock ii
BestTimeToBuyAndSellStockWithTransactionFee.kt→ best time to buy and sell stock ii
BestTimeToBuyAndSellStock_III.kt→ best time to buy and sell stock ii
BestTimeToBuyAndSellStock_II.kt→ best time to buy and sell stock ii

stream/ (1 files)

FileCoverage
MovingAverageOfARunningStream.ktvariant of find median from data stream

string/ (69 files)

FileCoverage
ApplySubstitutions.kt→ apply substitutions
CheckifaParenthesesStringCanBeValid.ktvariant of longest valid parentheses
CountAndSay.kt→ count rectangles formed by points
CountNumberOfWordsWhichAreSubSequence.ktvariant of count words with a given prefix
CountWordsWithAGivenPrefix.kt→ count words with a given prefix
DetectCapital.kt→ ipo (maximize capital)
ExcelSheetToColumnNumber.ktvariant of find the duplicate number
FindUniqueBinaryString.ktvariant of binary tree inorder traversal (iterative)
GoatLatin.kt→ goat latin
GreatestCommonDivisorOfStrings.ktsupport / non-problem
GroupAnagrams.kt→ group anagrams
IsSubsequence.kt→ closest subsequence sum
IsomorphicString.kt→ decode string
LengthOfLastWord.ktvariant of find first and last position of target
LongestCommonPrefix.kt→ longest common prefix
LongestPalidnromicSubstring.kt→ longest common substring
MaximumLengthofaConcatenatedStringwithUniqueCharacters.kt→ maximum length of concatenated string
MaximumNumberOfNonOverlappingPalindromicSubstring.ktvariant of longest palindromic substring
MaximumValueAfterInsertion.ktvariant of binary tree maximum path sum
MaximumValueOfAStringIsAnArray.ktvariant of binary tree maximum path sum
MergeStringAlternatively.ktvariant of decode string
MinimumDeletionToMakeCharacterFrequenciesUnique.ktvariant of first unique character
ReverseVowelOfString.kt→ reverse words in a string
ReverseWordsInString.kt→ reverse words in a string
StringCompression.kt→ decode string
StringCompression_II.kt→ decode string
ValidAnagram.kt→ valid anagram
ValidNumber.kt→ find the duplicate number
ValidPalindrome.kt→ valid palindrome
ValidPalindrome_II.kt→ valid palindrome
ValidWordAbbreviation.ktvariant of longest valid parentheses
ValidateIPAddress.kt→ validate ip address
ValidateIPAddressBetterImplementation.ktvariant of validate ip address
GenerateParantheses.kt→ generate parentheses
WordBreak_II.kt→ word break
WordSquare.kt→ maximal square
DeleteOperationsForTwoStrings.ktvariant of add two numbers
EditDistance.kt→ minimum edit distance
InterleavingString.kt→ decode string
LongestCommonSubsequence.kt→ longest common subsequence
LongestCommonSubstring.kt→ longest common substring
LongestPalindromicSubsequence.kt→ longest common subsequence
LongestPalindromicSubsequence_BottomUp.kt→ longest common subsequence
LongestStringChain.ktvariant of decode string
PalindromePartitioning_II.kt→ palindrome partitioning
RegularExpressionMatching.ktvariant of maximum bipartite matching
ShortestCommonSuperSequence_Modular.ktsupport / non-problem
ShortestCommonSupersequence.ktsupport / non-problem
ValidPalindrome_III.kt→ valid palindrome
ValidPalindrome_III_SpaceOptimized.ktvariant of valid palindrome
BreakAPalindrome.kt→ word break
ShortestWayToFormAString.ktsupport / non-problem
DetermineIfStringsAreClose.ktvariant of isomorphic strings
GroupShiftedStrings.ktvariant of group anagrams
PermutationsInString.kt→ decode string
UniqueLength3PalindromicSubsequence.ktvariant of closest subsequence sum
UniqueSubstringWithEqualDigitFrequency.ktvariant of first unique character
BengaliProgramming.ktsupport / non-problem
FindTheIndexofTheFirstOccurrenceIna String.kt→ find the index of the first occurrence (kmp)
FindTheIndexofTheFirstOccurrenceIna String_RabinKarp.kt→ find the index of the first occurrence (rabin-karp)
FindAllAnagrams.ktvariant of find first and last position of target
MaximumNumberofVowelsinSubstringofGivenLength.kt→ maximum length of concatenated string
MinimumWindowSubsequence.kt→ minimum window substring
MinimumWindowSubstring.kt→ minimum window substring
CustomSortString.ktvariant of decode string
CustomSortString_Linear.ktvariant of decode string
DecodeString.kt→ decode string
RemoveAllAdjacentDuplicatesInString.kt→ remove all adjacent duplicates
SimplifyPath.kt→ binary tree maximum path sum

tree/ (71 files)

FileCoverage
AllNodesDistanceKinBinaryTree.ktvariant of binary tree inorder traversal (iterative)
BInaryTreeInOrderTraversalIterative.kt→ binary tree inorder traversal (iterative)
BalancedBinaryTree.kt→ binary tree inorder traversal (iterative)
BinaryTreeLevelOrderTraversal.kt→ binary tree level order traversal
BinaryTreeMaximumPathSum.kt→ binary tree maximum path sum
BinaryTreeRightSideView.kt→ binary tree right side view
BinaryTreeVerticalOrderTraversal.kt→ binary tree level order traversal
BinaryTreeVerticalOrderTraversal_WithoutSorting.kt→ binary tree level order traversal
BinaryTreeZigZagLevelOrderTraversal.kt→ binary tree level order traversal
BoundaryOfBinaryTree.kt→ binary tree inorder traversal (iterative)
ConstructBinaryTreeFromInorderAndPostOrderTraversal.kt→ binary tree inorder traversal (iterative)
ConstructBinaryTreeFromPreorderAndInOrderTraversal.kt→ binary tree level order traversal
ConstructBinaryTreeFromString.kt→ binary tree inorder traversal (iterative)
CountGoodNodeInBInaryTree.ktvariant of binary tree inorder traversal (iterative)
CountNodeEqualsAverage.ktvariant of count rectangles formed by points
DiameterOfNArrayTree.kt→ diameter of binary tree
LeafSimilar.kt→ leaf-similar trees
LongestPathWithDifferentAdjacentCharacters.ktvariant of longest substring without repeating characters
LongestUnivaluePath.ktvariant of binary tree maximum path sum
LowestCommonAncestor.kt→ lowest common ancestor
LowestCommonAncestor_III.kt→ lowest common ancestor
MaximumDepthOfBinaryTree.kt→ maximum depth of binary tree
MaximumLevelSumOfABinaryTreee.ktvariant of binary tree maximum path sum
MaximumProductOfSplittedBinaryTree.kt→ binary tree maximum path sum
MaximumSumBSTInBinaryTree.kt→ binary tree maximum path sum
MaximumWidthOfBinaryTree.kt→ binary tree maximum path sum
MinimumTimeToCollectAllApplesInATree.kt→ minimum time to collect all apples
PathSum.kt→ binary tree maximum path sum
PathSumIII.kt→ path sum iii
PathSum_II.kt→ binary tree maximum path sum
PopulateNextRightPointersInEachNode_II.kt→ populating next right pointers in each node
PopulateNextRightPointersInEachNode_II_Constant.kt→ populating next right pointers in each node
PopulatingNextRightPointerInEachNode.kt→ populating next right pointers in each node
RecoverATreeFromPreOrderTraversal.ktvariant of binary tree level order traversal
SerializeAndDeserializeABinaryTree.kt→ serialize and deserialize binary tree
SerializeAndDeserializeNArrayTree.kt→ serialize and deserialize binary tree
SlidingWindowMedianTreeSet.kt→ sliding window median
StepByStepDirectionsFromANodeToAnother.kt→ step-by-step directions
SumRootToLeafNumbers.ktvariant of add two numbers
VerticalOrderTraversalOfABinaryTree.kt→ binary tree level order traversal
AverageOfLevelsInBinaryTree.kt→ binary tree inorder traversal (iterative)
BinaryTreeLevelOrderTraversal_II.kt→ binary tree level order traversal
CheckCompletenessOfBinaryTree.kt→ binary tree inorder traversal (iterative)
FindLargestValueInEachTreeRow.kt→ find largest value in each tree row
BSTIterator.kt→ bst iterator
ClosestBinarySearchTreeValue.ktvariant of binary tree inorder traversal (iterative)
ConvertBInarySearchTreeToSortedDoublyLinkedList.ktvariant of binary tree inorder traversal (iterative)
DeleteNodeinABST.ktvariant of insert delete getrandom o(1)
GetClosestElement.ktvariant of closest subsequence sum
InorderSuccessor.kt→ binary tree inorder traversal (iterative)
LongestIncreasingSubsequence.kt→ longest increasing subsequence
MinimumNumberOfRemovalsToMakeMountainArray.ktvariant of find minimum in rotated sorted array
MyCalendar.kt→ my calendar
OrderedStatisticsTree.ktvariant of binary tree inorder traversal (iterative)
OrderedStatisticsTreeForStreamers.ktvariant of binary tree inorder traversal (iterative)
RecoverBinarySearchTree.kt→ binary tree inorder traversal (iterative)
SkylineProblem.kt→ the skyline problem
StreamerRanking.kt→ streamer leaderboard
UniqueBinarySearchTrees.kt→ pattern primer: the binary search theorem
UniqueBinarySearchTrees_II.kt→ pattern primer: the binary search theorem
CountOfSmallerNumberAfterSelf.ktvariant of count rectangles formed by points
FenwickTree.ktsupport / non-problem
RangeSumQuery2dMutable.ktvariant of binary tree maximum path sum
RangeSumQueryMutable.ktvariant of binary tree maximum path sum
IntervalTree.kt→ binary tree inorder traversal (iterative)
MinCostToConnectAllPointsKruskal.kt→ min cost to connect all points
MinCostToConnectAllPointsPrims.kt→ min cost to connect all points (prim’s)
DynamicSegmentTree.ktvariant of binary tree inorder traversal (iterative)
IterativeSegmentTree.kt→ binary tree inorder traversal (iterative)
MyCalendar_II.kt→ my calendar ii
SegmentTree.kt→ binary tree inorder traversal (iterative)

trie/ (12 files)

FileCoverage
AbstractTrie.kt→ implement trie (prefix tree)
AutoCompleteSystem.kt→ design auto complete system
AutoCompleteSystemWithHeap.kt→ design auto complete system
CountWordsWithAGivenPrefix_Trie.kt→ count words with a given prefix
CountWordsWithAGivenPrefix_Trie_FP.kt→ count words with a given prefix
DesignAddAndSearchWordDataStructure.kt→ design add and search words
EqualRowAndColumnPairs.kt→ equal row and column pairs
LongestCommonPrefix.kt→ longest common prefix
SearchSuggestionSystem.kt→ search suggestion system
WordBreak_I.kt→ word break
WordSquare.kt→ maximal square
WordSquaresShorter.kt→ word squares