Skip to content

arpanpathak/AdvancedAlgorithmPatterns

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

322 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Problem Solutions Repository

This repository contains solutions to various algorithmic problems, organized by categories such as arrays, backtracking, binary search, graphs, and more. Each problem is solved in Kotlin, and the solutions are structured in a way that makes it easy to navigate and understand.

Purpose

The purpose of this repository is to provide a comprehensive collection of algorithmic problem solutions that can be used for learning, reference, or interview preparation. The problems are categorized by topic, and each solution is implemented in Kotlin.

How to Generate an Updated File List

To generate an updated list of all files in this repository, you can use the following shell command:

find . -type f | sort > all_problems.txt

This command will recursively find all files in the repository, sort them, and save the list to a file named all_problems.txt.

Repository Structure

Below is a tree-like structure of the repository with links to the files:

.
β”œβ”€β”€ GenerateReadme.kt
β”œβ”€β”€ Main.kt
β”œβ”€β”€ README.md
β”œβ”€β”€ all_files.txt
β”œβ”€β”€ **array/**
β”‚   β”œβ”€β”€ **Combinatorics/**
β”‚   β”‚   β”œβ”€β”€ ClosestSubsequenceSum.kt
β”‚   β”‚   β”œβ”€β”€ Combinations.kt
β”‚   β”‚   β”œβ”€β”€ NextGreaterElement_III.kt
β”‚   β”‚   β”œβ”€β”€ NextPermutation.kt
β”‚   β”‚   β”œβ”€β”€ Permutation_II.kt
β”‚   β”‚   β”œβ”€β”€ Permutation_II_Backtracking.kt
β”‚   β”‚   β”œβ”€β”€ Permutations.kt
β”‚   β”‚   └── Subsets.kt
β”‚   β”œβ”€β”€ DiagonalTraverse.kt
β”‚   β”œβ”€β”€ DiagonalTraverse_II.kt
β”‚   β”œβ”€β”€ InsertInterval.kt
β”‚   β”œβ”€β”€ MergeIntervals.kt
β”‚   β”œβ”€β”€ MergeSortedArray.kt
β”‚   β”œβ”€β”€ MissingRanges.kt
β”‚   β”œβ”€β”€ MoveZeroes.kt
β”‚   β”œβ”€β”€ RemoveElement.kt
β”‚   β”œβ”€β”€ RotateImage.kt
β”‚   β”œβ”€β”€ SearchA2dMatrix_II.kt
β”‚   β”œβ”€β”€ SetMatrixZeroes.kt
β”‚   β”œβ”€β”€ ShortestPathInBinaryMatrix.kt
β”‚   β”œβ”€β”€ SignOfTheProductOfAnArray.kt
β”‚   β”œβ”€β”€ SpiralMatrix.kt
β”‚   β”œβ”€β”€ SpiralMatrix_II.kt
β”‚   β”œβ”€β”€ ToeplitzMatrix.kt
β”‚   β”œβ”€β”€ TransposeMatrix.kt
β”‚   β”œβ”€β”€ **backtracking/**
β”‚   β”‚   β”œβ”€β”€ CombinationSum.kt
β”‚   β”‚   β”œβ”€β”€ CombinationSum3.kt
β”‚   β”‚   └── CombinationSum_II.kt
β”‚   β”œβ”€β”€ **cycle/**
β”‚   β”‚   └── FindTheDuplicateNumber.kt
β”‚   β”œβ”€β”€ **dfs/**
β”‚   β”‚   └── NestedListWeightedSum.kt
β”‚   β”œβ”€β”€ **dp/**
β”‚   β”‚   β”œβ”€β”€ BurstBaloons.kt
β”‚   β”‚   β”œβ”€β”€ CoinChange.kt
β”‚   β”‚   β”œβ”€β”€ CoinChange_II.kt
β”‚   β”‚   β”œβ”€β”€ CoinChange_II_BottomUp.kt
β”‚   β”‚   β”œβ”€β”€ HouseRobber.kt
β”‚   β”‚   β”œβ”€β”€ HouseRobber_II.kt
β”‚   β”‚   β”œβ”€β”€ KadensAlgorithm.kt
β”‚   β”‚   β”œβ”€β”€ LongestCommonSubarray.kt
β”‚   β”‚   β”œβ”€β”€ LongestIncreasingSequenceInAMatrix.kt
β”‚   β”‚   β”œβ”€β”€ LongestIncreasingSubsequence.kt
β”‚   β”‚   β”œβ”€β”€ MaximalSquare.kt
β”‚   β”‚   β”œβ”€β”€ MaximumSumOfNonAdjacentElements.kt
β”‚   β”‚   β”œβ”€β”€ MaximumSumSubArray.kt
β”‚   β”‚   β”œβ”€β”€ MinCostClimbingStaris.kt
β”‚   β”‚   β”œβ”€β”€ MinimumNumberofIncrementsSubarraysFormaTargetArray.kt
β”‚   β”‚   β”œβ”€β”€ MinimumPathSum.kt
β”‚   β”‚   β”œβ”€β”€ PartitionArrayIntoTwoArrayToMinimuzeSumDifference.kt
β”‚   β”‚   β”œβ”€β”€ SplitArrayLargestSum.kt
β”‚   β”‚   └── TargetSum.kt
β”‚   β”œβ”€β”€ **greedy/**
β”‚   β”‚   β”œβ”€β”€ CanPlaceFlowers.kt
β”‚   β”‚   β”œβ”€β”€ ContainerWithMostWater.kt
β”‚   β”‚   β”œβ”€β”€ IncreasingTripletSequence.kt
β”‚   β”‚   β”œβ”€β”€ KItemsWithMaximumSum.kt
β”‚   β”‚   β”œβ”€β”€ MaximumDistanceInArray.kt
β”‚   β”‚   β”œβ”€β”€ MaximumSwap.kt
β”‚   β”‚   β”œβ”€β”€ MergeOverlappingIntervals.kt
β”‚   β”‚   β”œβ”€β”€ MinimumNumberofSwapstoMaketheStringBalanced.kt
β”‚   β”‚   └── NonOverlappingIntervals.kt
β”‚   β”œβ”€β”€ **hashtable/**
β”‚   β”‚   β”œβ”€β”€ ContainsDuplicate_II.kt
β”‚   β”‚   β”œβ”€β”€ DivideArrayIntoEqualPairs.kt
β”‚   β”‚   β”œβ”€β”€ EqualRowAndColumnPairs.kt
β”‚   β”‚   β”œβ”€β”€ FindDifferenceOfTwoArrays.kt
β”‚   β”‚   β”œβ”€β”€ FindMissingPositive.kt
β”‚   β”‚   β”œβ”€β”€ FirstMissingPositive.kt
β”‚   β”‚   β”œβ”€β”€ IntegerToEnglishWords.kt
β”‚   β”‚   β”œβ”€β”€ LongestConsecutiveSequence.kt
β”‚   β”‚   β”œβ”€β”€ MaxNUmWithKSumPairs.kt
β”‚   β”‚   β”œβ”€β”€ RankTransformOfAnArray.kt
β”‚   β”‚   β”œβ”€β”€ SetMismatch.kt
β”‚   β”‚   β”œβ”€β”€ SnapshotArray.kt
β”‚   β”‚   β”œβ”€β”€ UniqueNumberOfOccurences.kt
β”‚   β”‚   └── ValidSudoku.kt
β”‚   β”œβ”€β”€ **prefixsum/**
β”‚   β”‚   β”œβ”€β”€ ContiguousArray.kt
β”‚   β”‚   β”œβ”€β”€ ContinuousSubarraySum.kt
β”‚   β”‚   β”œβ”€β”€ FIndTheHighestAltitute.kt
β”‚   β”‚   β”œβ”€β”€ FindPivotIndex.kt
β”‚   β”‚   β”œβ”€β”€ Minimum NumberofOperationstoMoveAllBallstoEachBox.kt
β”‚   β”‚   β”œβ”€β”€ NumberOfZeroFilledSubArrays.kt
β”‚   β”‚   β”œβ”€β”€ ProductOfArrayExceptSelf.kt
β”‚   β”‚   β”œβ”€β”€ SubArrayProductLessThanK.kt
β”‚   β”‚   β”œβ”€β”€ SubArraySumEqualsToK.kt
β”‚   β”‚   β”œβ”€β”€ SubArraySumsDivisibleByK.kt
β”‚   β”‚   └── ZeroArrayTransformation_I.kt
β”‚   β”œβ”€β”€ **random/**
β”‚   β”‚   └── RandomPickIndex.kt
β”‚   β”œβ”€β”€ **sorting/**
β”‚   β”‚   β”œβ”€β”€ SortColors.kt
β”‚   β”‚   └── SquaresOfASortedArray.kt
β”‚   β”œβ”€β”€ **sweepline/**
β”‚   β”‚   └── MaximumPopulationYear.kt
β”‚   └── **twopointer/**
β”‚       β”œβ”€β”€ 4Sum.kt
β”‚       β”œβ”€β”€ IntervalListIntersection.kt
β”‚       β”œβ”€β”€ RemoveDuplicateElementsFromSortedArray.kt
β”‚       β”œβ”€β”€ RemoveDuplicateElementsFromSortedArray_II.kt
β”‚       β”œβ”€β”€ RotateArray.kt
β”‚       β”œβ”€β”€ ThreeSum.kt
β”‚       β”œβ”€β”€ ThreeSumClosest.kt
β”‚       β”œβ”€β”€ TrappingRainWater.kt
β”‚       └── TwoSum_II.kt
β”œβ”€β”€ **automata/**
β”‚   └── **regular_language/**
β”œβ”€β”€ **autopilot/**
β”‚   └── H1bAutoPilotStressAnxietyAlgorithm.kt
β”œβ”€β”€ **backtracking/**
β”‚   β”œβ”€β”€ ExpressionAndAddOperators.kt
β”‚   β”œβ”€β”€ ExpressionAndAddOperatorsOptimized.kt
β”‚   β”œβ”€β”€ NQueen.kt
β”‚   β”œβ”€β”€ NQueen_II.kt
β”‚   β”œβ”€β”€ PalindromePartitioning.kt
β”‚   β”œβ”€β”€ PartitionToKEqualSumSubsets.kt
β”‚   β”œβ”€β”€ RestoreIPAddresses.kt
β”‚   β”œβ”€β”€ Strobogrammatic_Number_II.kt
β”‚   β”œβ”€β”€ SudokuSolver.kt
β”‚   └── SudokuSolverSet.kt
β”œβ”€β”€ **binarysearch/**
β”‚   β”œβ”€β”€ ApartmentHunting.kt
β”‚   β”œβ”€β”€ CapacityToShipPackageWithinDDays.kt
β”‚   β”œβ”€β”€ ClosestSebsequenceSum.kt
β”‚   β”œβ”€β”€ FindFirstAndLastPosition.kt
β”‚   β”œβ”€β”€ FindKClosestElements.kt
β”‚   β”œβ”€β”€ FindMinimumInRotatedSortedArray.kt
β”‚   β”œβ”€β”€ FindPeakElement.kt
β”‚   β”œβ”€β”€ FindPeakElementBetterSolution.kt
β”‚   β”œβ”€β”€ FirstBadVersion.kt
β”‚   β”œβ”€β”€ GuessNumberHigherOrLower.kt
β”‚   β”œβ”€β”€ HouseRobber_IV.kt
β”‚   β”œβ”€β”€ KThMissingPositiveNumber.kt
β”‚   β”œβ”€β”€ KokoEatingBanana.kt
β”‚   β”œβ”€β”€ MedianOfTwoSortedARrays.kt
β”‚   β”œβ”€β”€ PeakIndexInMountainArray.kt
β”‚   β”œβ”€β”€ RandomPickWithWeight.kt
β”‚   β”œβ”€β”€ SearchA2dMatrix.kt
β”‚   β”œβ”€β”€ SearchInRotatedArray_II.kt
β”‚   β”œβ”€β”€ SearchInRotatedSortedArray.kt
β”‚   β”œβ”€β”€ SearchInsertionPosition.kt
β”‚   β”œβ”€β”€ SingleElementInASortedArray.kt
β”‚   └── ValleyElement.kt
β”œβ”€β”€ **bitset/**
β”‚   β”œβ”€β”€ FirstLetterToAppearTwice.kt
β”‚   β”œβ”€β”€ LongestNiceSubarray.kt
β”‚   β”œβ”€β”€ MaximumXorOfTwoNumsInArray.kt
β”‚   β”œβ”€β”€ Number of Steps to ReduceaANumberInBinaryRepresentationtoOne.kt
β”‚   β”œβ”€β”€ NumberOfOneBits.kt
β”‚   β”œβ”€β”€ ReverseBits.kt
β”‚   β”œβ”€β”€ SingleNumber.kt
β”‚   β”œβ”€β”€ SingleNumber3.kt
β”‚   β”œβ”€β”€ SmallestNumberWithAllSetBits.kt
β”‚   └── SumOfAllSubsetXorTotal.kt
β”œβ”€β”€ **branch_and_bound/**
β”œβ”€β”€ **cache/**
β”‚   β”œβ”€β”€ LFUCache.kt
β”‚   β”œβ”€β”€ LRUCache.kt
β”‚   β”œβ”€β”€ LRUCacheBetter.kt
β”‚   β”œβ”€β”€ LRUCacheLinkedList.kt
β”‚   β”œβ”€β”€ LRUCleanAf.kt
β”‚   └── LruCacheBruceLee.kt
β”œβ”€β”€ **combinatorics/**
β”œβ”€β”€ **commons/**
β”‚   β”œβ”€β”€ APIEndPoints.kt
β”‚   β”œβ”€β”€ AlpacaWebSocketFactory.kt
β”‚   └── FileWriter.kt
β”œβ”€β”€ **disjointset/**
β”‚   β”œβ”€β”€ AccountMerge.kt
β”‚   β”œβ”€β”€ NumberOfIsland_II.kt
β”‚   β”œβ”€β”€ NumerOfIsland_II_Optimized.kt
β”‚   └── UnionFind.kt
β”œβ”€β”€ **divide_and_conquer/**
β”œβ”€β”€ **dynamic_programming/**
β”‚   β”œβ”€β”€ ClosestSubsequenceSum.kt
β”‚   β”œβ”€β”€ FrogJump.kt
β”‚   β”œβ”€β”€ MaximumProductSubarray.kt
β”‚   β”œβ”€β”€ MaximumProfitInJobScheduling.kt
β”‚   β”œβ”€β”€ PartitionEqualSubsetSum.kt
β”‚   └── SuperEggDropping.kt
β”œβ”€β”€ **facebook/**
β”‚   β”œβ”€β”€ FindMinimumTicketPrice.kt
β”‚   └── SecondGreatestNumber.kt
β”œβ”€β”€ **geo/**
β”‚   β”œβ”€β”€ **kdtree/**
β”‚   β”‚   └── KDTreeExample.kt
β”‚   └── **quadtree/**
β”‚       β”œβ”€β”€ ConstructQuadTree.kt
β”‚       β”œβ”€β”€ QuadTree.kt
β”‚       └── QuadTreeUsagePlaceFinding.kt
β”œβ”€β”€ **google/**
β”‚   └── LargestSquareAreaInMatrix.kt
β”œβ”€β”€ **graph/**
β”‚   β”œβ”€β”€ BusRoutes.kt
β”‚   β”œβ”€β”€ CalculateGraphDiameter.kt
β”‚   β”œβ”€β”€ ChromaticNumber.kt
β”‚   β”œβ”€β”€ CloneGraph.kt
β”‚   β”œβ”€β”€ DiameterOfBinaryTree.kt
β”‚   β”œβ”€β”€ HouseRobber3.kt
β”‚   β”œβ”€β”€ IsBipartileGraph.kt
β”‚   β”œβ”€β”€ IsBipartileGraphDfs.kt
β”‚   β”œβ”€β”€ MaximumPathQualityOfAGraph.kt
β”‚   β”œβ”€β”€ MinimumGeneticMutations.kt
β”‚   β”œβ”€β”€ NColoringGraph.kt
β”‚   β”œβ”€β”€ NColoringGreedy.kt
β”‚   β”œβ”€β”€ ReorderRoutesToMakeAllPathsLeadToCityZero.kt
β”‚   β”œβ”€β”€ WordLadder.kt
β”‚   β”œβ”€β”€ WordLadder_II.kt
β”‚   β”œβ”€β”€ WordLadder_II_clean.kt
β”‚   β”œβ”€β”€ **articulation_point/**
β”‚   β”‚   β”œβ”€β”€ CriticalConnectionsInANetwork.kt
β”‚   β”‚   β”œβ”€β”€ CriticalConnectionsInANetworkShortCode.kt
β”‚   β”‚   └── FindArticulationPoints.kt
β”‚   β”œβ”€β”€ **bst/**
β”‚   β”‚   β”œβ”€β”€ BinarySearchTreeToGreaterSumTree.kt
β”‚   β”‚   └── RangeSumOfBST.kt
β”‚   β”œβ”€β”€ **components/**
β”‚   β”‚   └── FindConnectedComponents.kt
β”‚   β”œβ”€β”€ **cycle/**
β”‚   β”‚   β”œβ”€β”€ CourseSchedule.kt
β”‚   β”‚   β”œβ”€β”€ CourseSchedule_II.kt
β”‚   β”‚   └── ParallelCourses.kt
β”‚   β”œβ”€β”€ **dag/**
β”‚   β”œβ”€β”€ **dp/**
β”‚   β”‚   β”œβ”€β”€ BellmanFordAlgorithm.kt
β”‚   β”‚   β”œβ”€β”€ CheapestFlightsWithinKStops.kt
β”‚   β”‚   β”œβ”€β”€ CheapestFlightsWithinKStopsBellman.kt
β”‚   β”‚   └── FloydWarshallAlgorithm.kt
β”‚   β”œβ”€β”€ **euler/**
β”‚   β”‚   └── **circuit/**
β”‚   β”‚       β”œβ”€β”€ CrackingTheSafe.kt
β”‚   β”‚       β”œβ”€β”€ EulerianGraph.kt
β”‚   β”‚       └── **path/**
β”‚   β”‚           └── ReconstructItenary.kt
β”‚   β”œβ”€β”€ **greedy/**
β”‚   β”‚   β”œβ”€β”€ CheapestFlightWithKStops.kt
β”‚   β”‚   β”œβ”€β”€ CheapestFlightsWithKStops.kt
β”‚   β”‚   β”œβ”€β”€ DonaldTrumpAlgorithm.kt
β”‚   β”‚   └── TheMaze_III.kt
β”‚   β”œβ”€β”€ **mst/**
β”‚   β”‚   β”œβ”€β”€ FindRedundentConnections.kt
β”‚   β”‚   β”œβ”€β”€ OptimizeWaterDistributionInAVillage.kt
β”‚   β”‚   β”œβ”€β”€ PrimsAlgorithm.kt
β”‚   β”‚   └── PrimsShorter.kt
β”‚   β”œβ”€β”€ **scc/**
β”‚   β”‚   β”œβ”€β”€ Kosaraju.kt
β”‚   β”‚   └── Tarjans.kt
β”‚   β”œβ”€β”€ **topological_sort/**
β”‚   β”‚   β”œβ”€β”€ AlienDictionary.kt
β”‚   β”‚   β”œβ”€β”€ AlienDictionary_BFS.kt
β”‚   β”‚   β”œβ”€β”€ ApplySubstitutions.kt
β”‚   β”‚   β”œβ”€β”€ CourseSchedule_II.kt
β”‚   β”‚   └── CourseSchedule_II_BFS.kt
β”‚   └── **tsp/**
β”‚       β”œβ”€β”€ ShortestPathVisitingAllNodes.kt
β”‚       β”œβ”€β”€ TSPHelpKarp.kt
β”‚       └── TravellingSalespersonProblemBruteforceMatrix.kt
β”œβ”€β”€ **greedy/**
β”‚   β”œβ”€β”€ CarFleet.kt
β”‚   β”œβ”€β”€ DestroyingAsteroids.kt
β”‚   β”œβ”€β”€ JumpGame.kt
β”‚   β”œβ”€β”€ JumpGame_II.kt
β”‚   β”œβ”€β”€ MInimumCostHomecomingOfARobot.kt
β”‚   β”œβ”€β”€ MaxChuncksToMakeSorted_II.kt
β”‚   β”œβ”€β”€ MaxProfiAssigningWork.kt
β”‚   β”œβ”€β”€ MaximumValueOfAnOrderedTriplet_II.kt
β”‚   β”œβ”€β”€ MeetingRooms.kt
β”‚   β”œβ”€β”€ MeetingRooms_II.kt
β”‚   β”œβ”€β”€ MeetingRooms_II_greedy.kt
β”‚   β”œβ”€β”€ MinimumDeletionsToMakeStringBalanced.kt
β”‚   β”œβ”€β”€ MinimumReplacementToSortTheArray.kt
β”‚   β”œβ”€β”€ MinimumTimeToMakeRopeColorful.kt
β”‚   β”œβ”€β”€ RescheduleMeetingsforMaximumFreeTime_I.kt
β”‚   └── TaskScheduler.kt
β”œβ”€β”€ **grid/**
β”‚   β”œβ”€β”€ FloodFill.kt
β”‚   β”œβ”€β”€ IslandPerimeter.kt
β”‚   β”œβ”€β”€ MakingALargeIsland.kt
β”‚   β”œβ”€β”€ MakingALargeIsland_AnotherApproach.kt
β”‚   β”œβ”€β”€ MaxAreaOfIsland.kt
β”‚   β”œβ”€β”€ MaximumNumberOfFishInAGrid.kt
β”‚   β”œβ”€β”€ PacificAtlanticWaterFlow.kt
β”‚   β”œβ”€β”€ RottingOranges.kt
β”‚   β”œβ”€β”€ ShortestBridge.kt
β”‚   β”œβ”€β”€ ShortestDistanceFromAllBuildings.kt
β”‚   β”œβ”€β”€ WallsAndGates.kt
β”‚   β”œβ”€β”€ **a_star/**
β”‚   β”‚   └── ShortestPathInGridWithObstaclesElimination.kt
β”‚   β”œβ”€β”€ **dynamic_programming/**
β”‚   β”‚   β”œβ”€β”€ CherryPickup.kt
β”‚   β”‚   β”œβ”€β”€ Test.kt
β”‚   β”‚   β”œβ”€β”€ UniquePaths_I.kt
β”‚   β”‚   └── UniquePaths_II.kt
β”‚   β”œβ”€β”€ **histogram/**
β”‚   β”‚   └── MaximalRectangle.kt
β”‚   └── **search/**
β”‚       └── WordSearch_II.kt
β”œβ”€β”€ **hashtable/**
β”‚   β”œβ”€β”€ CountNumberOfBadPairs.kt
β”‚   β”œβ”€β”€ DesignANumberContainerSystem.kt
β”‚   β”œβ”€β”€ DesignFileSystem.kt
β”‚   β”œβ”€β”€ DesignHashMap.kt
β”‚   β”œβ”€β”€ FirstUniqueCharacter.kt
β”‚   β”œβ”€β”€ HIndex.kt
β”‚   β”œβ”€β”€ IntegerToRoman.kt
β”‚   β”œβ”€β”€ IntersectionOfTwoArray.kt
β”‚   β”œβ”€β”€ MaximumFrequencyStack.kt
β”‚   β”œβ”€β”€ RomanToInteger.kt
β”‚   β”œβ”€β”€ WorkBreak_II.kt
β”‚   └── WorlBreak_I_DP.kt
β”œβ”€β”€ **heap/**
β”‚   β”œβ”€β”€ DualBalancedHeap.kt
β”‚   β”œβ”€β”€ FindKClosestElements.kt
β”‚   β”œβ”€β”€ FindScoreOfAnArrayAfterMarkingAllElements.kt
β”‚   β”œβ”€β”€ FindingMKAverage.kt
β”‚   β”œβ”€β”€ IPO.kt
β”‚   β”œβ”€β”€ LongestHappyString.kt
β”‚   β”œβ”€β”€ MedianFromRunningStream.kt
β”‚   β”œβ”€β”€ MeetingRoom_III.kt
β”‚   β”œβ”€β”€ SingleThreadedCPU.kt
β”‚   β”œβ”€β”€ SlidingWindowMedian.kt
β”‚   └── TopKFrequentElements.kt
β”œβ”€β”€ **linkedlist/**
β”‚   β”œβ”€β”€ AddTwoNumbers.kt
β”‚   β”œβ”€β”€ CopyLinkedListWithRandomPointer.kt
β”‚   β”œβ”€β”€ DeleteMiddleNodeOfLinkedList.kt
β”‚   β”œβ”€β”€ InsertIntoASortedCircularLinkedList.kt
β”‚   β”œβ”€β”€ InsertIntoASortedCircularList.kt
β”‚   β”œβ”€β”€ IntersectionOfTwoLinkedList.kt
β”‚   β”œβ”€β”€ LinkedListCycle.kt
β”‚   β”œβ”€β”€ LinkedListCycle_II.kt
β”‚   β”œβ”€β”€ MaximumTwinSumOfALinkedList.kt
β”‚   β”œβ”€β”€ MergeKSortedList.kt
β”‚   β”œβ”€β”€ MergeKSortedListIterative.kt
β”‚   β”œβ”€β”€ MergeTwoSortedLIst.kt
β”‚   β”œβ”€β”€ MiddleNode.kt
β”‚   β”œβ”€β”€ OddEvenLinkedList.kt
β”‚   β”œβ”€β”€ OddOrEvenLinkedList.kt
β”‚   β”œβ”€β”€ PalindromeLinkedList.kt
β”‚   β”œβ”€β”€ RemoveNthNodeFromEndOfList.kt
β”‚   β”œβ”€β”€ ReverseLinkedList.kt
β”‚   β”œβ”€β”€ ReverseLinkedListIterative.kt
β”‚   β”œβ”€β”€ ReverseNodesInKGroups.kt
β”‚   β”œβ”€β”€ RotateList.kt
β”‚   └── SwapNodesInPairs.kt
β”œβ”€β”€ **math/**
β”‚   β”œβ”€β”€ AddStrings.kt
β”‚   β”œβ”€β”€ DesignTicTacToe.kt
β”‚   β”œβ”€β”€ DetectSquares.kt
β”‚   β”œβ”€β”€ DivideTwoIntegers.kt
β”‚   β”œβ”€β”€ HappyNumber.kt
β”‚   β”œβ”€β”€ MinimumMovesToEqualArrayElements.kt
β”‚   β”œβ”€β”€ MultiplyStrings.kt
β”‚   β”œβ”€β”€ PlusOne.kt
β”‚   β”œβ”€β”€ PowerOfTwo.kt
β”‚   β”œβ”€β”€ ReverseInteger.kt
β”‚   β”œβ”€β”€ SlidingPuzzle.kt
β”‚   β”œβ”€β”€ Sqrt.kt
β”‚   β”œβ”€β”€ StringtoIntegerAtoi.kt
β”‚   β”œβ”€β”€ **binary/**
β”‚   β”‚   └── AddBinary.kt
β”‚   β”œβ”€β”€ **dp/**
β”‚   β”‚   └── PascalsTriangle.kt
β”‚   β”œβ”€β”€ **geometry/**
β”‚   β”‚   β”œβ”€β”€ ConvexHull.kt
β”‚   β”‚   β”œβ”€β”€ CountNumberOfTrapizoids_I.kt
β”‚   β”‚   β”œβ”€β”€ ErectTheFence_ConvexHull.kt
β”‚   β”‚   β”œβ”€β”€ HowManyRectanglesOverlapSweepLine.kt
β”‚   β”‚   β”œβ”€β”€ HowManyRectanglesOverlaping.kt
β”‚   β”‚   β”œβ”€β”€ MaxPointsOnALine.kt
β”‚   β”‚   β”œβ”€β”€ RectangleArea.kt
β”‚   β”‚   β”œβ”€β”€ RectangleOverlap.kt
β”‚   β”‚   β”œβ”€β”€ **binarysearch/**
β”‚   β”‚   β”‚   └── SeperateSquares_I.kt
β”‚   β”‚   └── **interval/**
β”‚   β”‚       β”œβ”€β”€ HowManyRectangleOverlapsIntervalTree.kt
β”‚   β”‚       └── RectangeOverlapCountTreeSet.kt
β”‚   β”œβ”€β”€ pow.kt
β”‚   └── **stack/**
β”‚       β”œβ”€β”€ BasicCalculator.kt
β”‚       β”œβ”€β”€ BasicCalculator_I.kt
β”‚       β”œβ”€β”€ BasicCalculator_II.kt
β”‚       β”œβ”€β”€ BasicCalculator_III.kt
β”‚       └── BasicCalculator_II_ShortCode.kt
β”œβ”€β”€ **microsoft/**
β”‚   β”œβ”€β”€ Demo.kt
β”‚   β”œβ”€β”€ NonNegativeSum.java
β”‚   β”œβ”€β”€ Toast.kt
β”‚   └── ValidTime.kt
β”œβ”€β”€ **ml/**
β”‚   └── **classical/**
β”‚       └── **tree/**
β”‚           β”œβ”€β”€ **core/**
β”‚           β”‚   └── DecisionTree.kt
β”‚           └── **ensemble/**
β”œβ”€β”€ **nlp/**
β”œβ”€β”€ **numbers/**
β”‚   └── PalindromeNumber.kt
β”œβ”€β”€ **probability/**
β”‚   β”œβ”€β”€ InsertDeleteGetRandom.kt
β”‚   β”œβ”€β”€ InsertDeleteGetRandomAtO1.kt
β”‚   β”œβ”€β”€ LinkedListRandomNode.kt
β”‚   β”œβ”€β”€ PathWithMaximumProbability.kt
β”‚   └── ReservoirSampling.kt
β”œβ”€β”€ **queues/**
β”‚   └── **dequeue/**
β”œβ”€β”€ **queueu/**
β”‚   └── **dequeue/**
β”‚       β”œβ”€β”€ DesignACircularQueue.kt
β”‚       β”œβ”€β”€ DesignHitCounter.kt
β”‚       β”œβ”€β”€ NumberOfRecentCalls.kt
β”‚       └── ProductOfLastKNumbers.kt
β”œβ”€β”€ **quicksort/**
β”‚   β”œβ”€β”€ KClosestPointsToOrigin.kt
β”‚   β”œβ”€β”€ KThLargestElementInArray.kt
β”‚   β”œβ”€β”€ KthLargestElementInArrayTailRec.kt
β”‚   └── TopKFrequentElements.kt
β”œβ”€β”€ **real_word_projects/**
β”‚   β”œβ”€β”€ HttpApiCall.kt
β”‚   β”œβ”€β”€ InterfaceExample.kt
β”‚   β”œβ”€β”€ ParallelFibonacci.kt
β”‚   β”œβ”€β”€ ScaleTransactions.kt
β”‚   β”œβ”€β”€ SystemInterviewHack.kt
β”‚   β”œβ”€β”€ TradingAPICallExample.kt
β”‚   β”œβ”€β”€ **advertisement/**
β”‚   β”‚   └── DataModels.kt
β”‚   β”œβ”€β”€ **consistent_hashing/**
β”‚   β”‚   └── ConsistentHashing.kt
β”‚   β”œβ”€β”€ **database/**
β”‚   β”‚   └── AiTest.kt
β”‚   β”œβ”€β”€ **dynamic_programming/**
β”‚   β”‚   └── DuckworthLewisStern.kt
β”‚   β”œβ”€β”€ **json/**
β”‚   β”‚   └── JsonExample.kt
β”‚   β”œβ”€β”€ **parallel_algorithms/**
β”‚   β”‚   β”œβ”€β”€ FindMaxInArray.kt
β”‚   β”‚   └── ParallelMatrixMultiplication.kt
β”‚   └── **trading/**
β”‚       β”œβ”€β”€ AlpacaSDKExamples.kt
β”‚       β”œβ”€β”€ RealtimeMarketDataStreaming.kt
β”‚       β”œβ”€β”€ **stream/**
β”‚       β”œβ”€β”€ system_design_plantuml.txt
β”‚       └── trading_data.json
β”œβ”€β”€ **simulation/**
β”‚   β”œβ”€β”€ CarPooling.kt
β”‚   β”œβ”€β”€ CountCollisionsOnARoad.kt
β”‚   β”œβ”€β”€ FindWinnerOnATicTacToeGame.kt
β”‚   β”œβ”€β”€ Racecar.kt
β”‚   β”œβ”€β”€ RobotBoundedInCircle.kt
β”‚   └── TextJustification.kt
β”œβ”€β”€ **sliding_window/**
β”‚   β”œβ”€β”€ LongestContinuousSubarrayWithAbsoluteDifferenceLessThanOrEqualToLimit.kt
β”‚   β”œβ”€β”€ LongestRepeatingCharacterReplacement.kt
β”‚   β”œβ”€β”€ LongestSubArraysOfOneAfterDeletingOneElement.kt
β”‚   β”œβ”€β”€ LongestSubstringWithoutRepeatingCharacter.kt
β”‚   β”œβ”€β”€ MaxConsecutiveOnes_III.kt
β”‚   β”œβ”€β”€ MaximumAverageSubarray_I.kt
β”‚   β”œβ”€β”€ MaximumErasureValue.kt
β”‚   β”œβ”€β”€ MaximumSumOfDistinctSubarraysWithLengthK.kt
β”‚   β”œβ”€β”€ MinimumSizeSubarraySum.kt
β”‚   β”œβ”€β”€ MinimumSwapsToGroupAllOnesTogether.kt
β”‚   β”œβ”€β”€ PartitionLabels.kt
β”‚   β”œβ”€β”€ ProgrammerString.kt
β”‚   └── SlidingWindowMaximum.kt
β”œβ”€β”€ **sorting/**
β”‚   β”œβ”€β”€ EmployeeFreeTime.kt
β”‚   β”œβ”€β”€ HIndex.kt
β”‚   β”œβ”€β”€ LargestNumber.kt
β”‚   β”œβ”€β”€ MergeSort.kt
β”‚   β”œβ”€β”€ RankTeamsByVote.kt
β”‚   └── RussianDollEnvelope.kt
β”œβ”€β”€ **speed_dating/**
β”‚   └── ComputerScienceEngineerDating.kt
β”œβ”€β”€ **stack/**
β”‚   β”œβ”€β”€ AestroidCollisions.kt
β”‚   β”œβ”€β”€ BuildingsWithAnOceanView.kt
β”‚   β”œβ”€β”€ DailyTemperatures.kt
β”‚   β”œβ”€β”€ DesignAStackWithIncrementOperations.kt
β”‚   β”œβ”€β”€ EvaluateReversePolishNotation.kt
β”‚   β”œβ”€β”€ ExclusiveTimeOfFunctions.kt
β”‚   β”œβ”€β”€ FlattenNestedListIterator.kt
β”‚   β”œβ”€β”€ LargestRectangleInHistogram.kt
β”‚   β”œβ”€β”€ LongestValidParanthesis.kt
β”‚   β”œβ”€β”€ MinStack.kt
β”‚   β”œβ”€β”€ MinimumAddtoMakeParenthesesValid.kt
β”‚   β”œβ”€β”€ MinimumDeletionsToMakeStringBalanced.kt
β”‚   β”œβ”€β”€ MinimumRemoveToMakeValidParentheses.kt
β”‚   β”œβ”€β”€ NextGreaterElement_I.kt
β”‚   β”œβ”€β”€ NextGreaterElement_II.kt
β”‚   β”œβ”€β”€ NumberOfVisiblePeopleInAQueue.kt
β”‚   β”œβ”€β”€ OneThreeTwoPattern.kt
β”‚   β”œβ”€β”€ OnlineStockSpan.kt
β”‚   β”œβ”€β”€ RemoveDuplicateLetters.kt
β”‚   β”œβ”€β”€ RemoveStarsFromString.kt
β”‚   β”œβ”€β”€ SmallestSubsequenceOfDistinctCharacters.kt
β”‚   β”œβ”€β”€ SumOfSubArrayMinimum.kt
β”‚   β”œβ”€β”€ SumOfSubArrayRanges.kt
β”‚   └── ValidParentheses.kt
β”œβ”€β”€ **stock_market/**
β”‚   β”œβ”€β”€ **dp/**
β”‚   β”‚   β”œβ”€β”€ BestTimeToBuyAndSellStock.kt
β”‚   β”‚   β”œβ”€β”€ BestTimeToBuyAndSellStockWithCooldown.kt
β”‚   β”‚   β”œβ”€β”€ BestTimeToBuyAndSellStockWithTransactionFee.kt
β”‚   β”‚   └── BestTimeToBuyAndSellStock_III.kt
β”‚   └── **greedy/**
β”‚       └── BestTimeToBuyAndSellStock_II.kt
β”œβ”€β”€ **stream/**
β”‚   └── MovingAverageOfARunningStream.kt
β”œβ”€β”€ **string/**
β”‚   β”œβ”€β”€ ApplySubstitutions.kt
β”‚   β”œβ”€β”€ CheckifaParenthesesStringCanBeValid.kt
β”‚   β”œβ”€β”€ CountAndSay.kt
β”‚   β”œβ”€β”€ CountNumberOfWordsWhichAreSubSequence.kt
β”‚   β”œβ”€β”€ CountWordsWithAGivenPrefix.kt
β”‚   β”œβ”€β”€ ExcelSheetToColumnNumber.kt
β”‚   β”œβ”€β”€ FindUniqueBinaryString.kt
β”‚   β”œβ”€β”€ GoatLatin.kt
β”‚   β”œβ”€β”€ GreatestCommonDivisorOfStrings.kt
β”‚   β”œβ”€β”€ GroupAnagrams.kt
β”‚   β”œβ”€β”€ IsSubsequence.kt
β”‚   β”œβ”€β”€ IsomorphicString.kt
β”‚   β”œβ”€β”€ LengthOfLastWord.kt
β”‚   β”œβ”€β”€ LongestCommonPrefix.kt
β”‚   β”œβ”€β”€ LongestPalidnromicSubstring.kt
β”‚   β”œβ”€β”€ MaximumLengthofaConcatenatedStringwithUniqueCharacters.kt
β”‚   β”œβ”€β”€ MaximumValueOfAStringIsAnArray.kt
β”‚   β”œβ”€β”€ MergeStringAlternatively.kt
β”‚   β”œβ”€β”€ MinimumDeletionToMakeCharacterFrequenciesUnique.kt
β”‚   β”œβ”€β”€ ReverseVowelOfString.kt
β”‚   β”œβ”€β”€ ReverseWordsInString.kt
β”‚   β”œβ”€β”€ StringCompression.kt
β”‚   β”œβ”€β”€ StringCompression_II.kt
β”‚   β”œβ”€β”€ ValidAnagram.kt
β”‚   β”œβ”€β”€ ValidNumber.kt
β”‚   β”œβ”€β”€ ValidPalindrome.kt
β”‚   β”œβ”€β”€ ValidPalindrome_II.kt
β”‚   β”œβ”€β”€ ValidWordAbbreviation.kt
β”‚   β”œβ”€β”€ ValidateIPAddress.kt
β”‚   β”œβ”€β”€ **backtracking/**
β”‚   β”‚   └── GenerateParantheses.kt
β”‚   β”œβ”€β”€ **dynamic_programming/**
β”‚   β”‚   β”œβ”€β”€ DeleteOperationsForTwoStrings.kt
β”‚   β”‚   β”œβ”€β”€ EditDistance.kt
β”‚   β”‚   β”œβ”€β”€ InterleavingString.kt
β”‚   β”‚   β”œβ”€β”€ LongestCommonSubsequence.kt
β”‚   β”‚   β”œβ”€β”€ LongestCommonSubstring.kt
β”‚   β”‚   β”œβ”€β”€ LongestPalindromicSubsequence.kt
β”‚   β”‚   β”œβ”€β”€ LongestPalindromicSubsequence_BottomUp.kt
β”‚   β”‚   β”œβ”€β”€ LongestStringChain.kt
β”‚   β”‚   β”œβ”€β”€ RegularExpressionMatching.kt
β”‚   β”‚   β”œβ”€β”€ ShortestCommonSupersequence.kt
β”‚   β”‚   β”œβ”€β”€ ValidPalindrome_III.kt
β”‚   β”‚   └── ValidPalindrome_III_SpaceOptimized.kt
β”‚   β”œβ”€β”€ **greedy/**
β”‚   β”‚   β”œβ”€β”€ BreakAPalindrome.kt
β”‚   β”‚   └── ShortestWayToFormAString.kt
β”‚   β”œβ”€β”€ **hashtable/**
β”‚   β”‚   β”œβ”€β”€ DetermineIfStringsAreClose.kt
β”‚   β”‚   β”œβ”€β”€ GroupShiftedStrings.kt
β”‚   β”‚   β”œβ”€β”€ PermutationsInString.kt
β”‚   β”‚   β”œβ”€β”€ UniqueLength3PalindromicSubsequence.kt
β”‚   β”‚   └── UniqueSubstringWithEqualDigitFrequency.kt
β”‚   β”œβ”€β”€ **pattern_matching/**
β”‚   β”‚   β”œβ”€β”€ FindTheIndexofTheFirstOccurrenceIna String.kt
β”‚   β”‚   └── FindTheIndexofTheFirstOccurrenceIna String_RabinKarp.kt
β”‚   β”œβ”€β”€ **sliding_window/**
β”‚   β”‚   β”œβ”€β”€ FindAllAnagrams.kt
β”‚   β”‚   β”œβ”€β”€ MaximumNumberofVowelsinSubstringofGivenLength.kt
β”‚   β”‚   └── MinimumWindowSubstring.kt
β”‚   β”œβ”€β”€ **sorting/**
β”‚   β”‚   β”œβ”€β”€ CustomSortString.kt
β”‚   β”‚   └── CustomSortString_Linear.kt
β”‚   β”œβ”€β”€ **stack/**
β”‚   β”‚   β”œβ”€β”€ DecodeString.kt
β”‚   β”‚   β”œβ”€β”€ RemoveAllAdjacentDuplicatesInString.kt
β”‚   β”‚   └── SimplifyPath.kt
β”‚   └── **travelling_salesman/**
β”œβ”€β”€ **trading/**
β”‚   └── trading_data.json
β”œβ”€β”€ **tree/**
β”‚   β”œβ”€β”€ AllNodesDistanceKinBinaryTree.kt
β”‚   β”œβ”€β”€ BInaryTreeInOrderTraversalIterative.kt
β”‚   β”œβ”€β”€ BalancedBinaryTree.kt
β”‚   β”œβ”€β”€ BinaryTreeLevelOrderTraversal.kt
β”‚   β”œβ”€β”€ BinaryTreeMaximumPathSum.kt
β”‚   β”œβ”€β”€ BinaryTreeRightSideView.kt
β”‚   β”œβ”€β”€ BinaryTreeVerticalOrderTraversal.kt
β”‚   β”œβ”€β”€ BinaryTreeVerticalOrderTraversal_WithoutSorting.kt
β”‚   β”œβ”€β”€ BinaryTreeZigZagLevelOrderTraversal.kt
β”‚   β”œβ”€β”€ BoundaryOfBinaryTree.kt
β”‚   β”œβ”€β”€ ConstructBinaryTreeFromInorderAndPostOrderTraversal.kt
β”‚   β”œβ”€β”€ ConstructBinaryTreeFromPreorderAndInOrderTraversal.kt
β”‚   β”œβ”€β”€ ConstructBinaryTreeFromString.kt
β”‚   β”œβ”€β”€ CountGoodNodeInBInaryTree.kt
β”‚   β”œβ”€β”€ CountNodeEqualsAverage.kt
β”‚   β”œβ”€β”€ DiameterOfNArrayTree.kt
β”‚   β”œβ”€β”€ LeafSimilar.kt
β”‚   β”œβ”€β”€ LongestPathWithDifferentAdjacentCharacters.kt
β”‚   β”œβ”€β”€ LongestUnivaluePath.kt
β”‚   β”œβ”€β”€ LowestCommonAncestor.kt
β”‚   β”œβ”€β”€ LowestCommonAncestor_III.kt
β”‚   β”œβ”€β”€ MaximumDepthOfBinaryTree.kt
β”‚   β”œβ”€β”€ MaximumSumBSTInBinaryTree.kt
β”‚   β”œβ”€β”€ MaximumWidthOfBinaryTree.kt
β”‚   β”œβ”€β”€ MinimumTimeToCollectAllApplesInATree.kt
β”‚   β”œβ”€β”€ PathSum.kt
β”‚   β”œβ”€β”€ PathSumIII.kt
β”‚   β”œβ”€β”€ PathSum_II.kt
β”‚   β”œβ”€β”€ PopulateNextRightPointersInEachNode_II.kt
β”‚   β”œβ”€β”€ PopulateNextRightPointersInEachNode_II_Constant.kt
β”‚   β”œβ”€β”€ PopulatingNextRightPointerInEachNode.kt
β”‚   β”œβ”€β”€ RecoverATreeFromPreOrderTraversal.kt
β”‚   β”œβ”€β”€ SerializeAndDeserializeABinaryTree.kt
β”‚   β”œβ”€β”€ SerializeAndDeserializeNArrayTree.kt
β”‚   β”œβ”€β”€ SlidingWindowMedianTreeSet.kt
β”‚   β”œβ”€β”€ StepByStepDirectionsFromANodeToAnother.kt
β”‚   β”œβ”€β”€ SumRootToLeafNumbers.kt
β”‚   β”œβ”€β”€ VerticalOrderTraversalOfABinaryTree.kt
β”‚   β”œβ”€β”€ **bfs/**
β”‚   β”‚   β”œβ”€β”€ AverageOfLevelsInBinaryTree.kt
β”‚   β”‚   β”œβ”€β”€ BinaryTreeLevelOrderTraversal_II.kt
β”‚   β”‚   β”œβ”€β”€ CheckCompletenessOfBinaryTree.kt
β”‚   β”‚   └── FindLargestValueInEachTreeRow.kt
β”‚   β”œβ”€β”€ **bst/**
β”‚   β”‚   β”œβ”€β”€ BSTIterator.kt
β”‚   β”‚   β”œβ”€β”€ ClosestBinarySearchTreeValue.kt
β”‚   β”‚   β”œβ”€β”€ ConvertBInarySearchTreeToSortedDoublyLinkedList.kt
β”‚   β”‚   β”œβ”€β”€ DeleteNodeinABST.kt
β”‚   β”‚   β”œβ”€β”€ InorderSuccessor.kt
β”‚   β”‚   β”œβ”€β”€ LongestIncreasingSubsequence.kt
β”‚   β”‚   β”œβ”€β”€ RecoverBinarySearchTree.kt
β”‚   β”‚   β”œβ”€β”€ SkylineProblem.kt
β”‚   β”‚   β”œβ”€β”€ UniqueBinarySearchTrees.kt
β”‚   β”‚   └── UniqueBinarySearchTrees_II.kt
β”‚   β”œβ”€β”€ **fenwick/**
β”‚   β”‚   β”œβ”€β”€ CountOfSmallerNumberAfterSelf.kt
β”‚   β”‚   β”œβ”€β”€ FenwickTree.kt
β”‚   β”‚   β”œβ”€β”€ RangeSumQuery2dMutable.kt
β”‚   β”‚   └── RangeSumQueryMutable.kt
β”‚   β”œβ”€β”€ **interval/**
β”‚   β”‚   └── IntervalTree.kt
β”‚   β”œβ”€β”€ **mst/**
β”‚   β”‚   β”œβ”€β”€ MinCostToConnectAllPointsKruskal.kt
β”‚   β”‚   └── MinCostToConnectAllPointsPrims.kt
β”‚   └── **segment/**
β”‚       └── SegmentTree.kt
└── **trie/**
    β”œβ”€β”€ AutoCompleteSystem.kt
    β”œβ”€β”€ AutoCompleteSystemWithHeap.kt
    β”œβ”€β”€ CountWordsWithAGivenPrefix_Trie.kt
    β”œβ”€β”€ CountWordsWithAGivenPrefix_Trie_FP.kt
    β”œβ”€β”€ DesignAddAndSearchWordDataStructure.kt
    β”œβ”€β”€ EqualRowAndColumnPairs.kt
    β”œβ”€β”€ LongestCommonPrefix.kt
    β”œβ”€β”€ SearchSuggestionSystem.kt
    └── WordBreak_I.kt

Contributing

If you would like to contribute to this repository, feel free to submit a pull request. Please ensure that your solutions are well-documented and follow the existing structure.

License

This repository is licensed under the MIT License. See the LICENSE file for more details.


Happy coding! πŸš€

About

Data Structure & Algorithmic problems solved in Kotlin

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages