This repository contains the solutions and explanations to the algorithm problems on LeetCode. Only medium or above are included. All are written in C++/Python and implemented by myself. The problems attempted multiple times are labelled with hyperlinks.
Array Find duplicate in an array of N+1 Integers https://leetcode.com/problems/find-the-duplicate-number/ Array Merge 2 sorted arrays without using Extra space. https://leetcode.com/problems/merge-sorted-array/ Array Kadane's Algorithm https://leetcode.com/problems/maximum-subarray/ ...
thanks for the explanation.but i have a doubt that we are doing dijkstra from the source c (the city with the minimum cost) wouldn't that give the shortest cost of all the other node from the source 'c' only..also ans[i] = min(arr[i],ans[j]+2*weight[i][j]) what if there...
Traditional backtracing is like, you are trying to find a place on the ground, because you cannot see through blocks.. OK, so the computer god Donald Knuth invented a smarter tool - dancing links. This is like, find a place on a helicopter floating above the city. You are able to see...
While Dijkstra Shortest Path algorithm helps find shortest path between start and end vertex, [FloydWarshallAlgorithm] finds the shortest path between all vertices in a [graph] Source PrimMinSpanningTreeAlgorithm Kotlin • algorithmsinanutshell Prim Algorithm starts from min cost edge and then selec...
LeetCode R.I.P. to my old Leetcode repository, where there were 5.7k+ stars and 2.2k+ forks (ever the top 3 in the field). Since free questions may be even mistakenly taken down by some companies, only solutions will be post on now. There are new LeetCode questions every week. I...
《看得见的算法》课程, 代码仓: Play-with-Algorithm-Visualization 《玩转数据结构》课程, 代码仓: Play-with-Data-Structures LeetCode Explore题解代码仓:Play Leetcode Explore (注:以C++实现为主) Leetcode Explore 是Leetcode 在2017年底上线的新模块,分门别类地整理了Leetcode上的问题。如果刷Leetcode一...
Graph Theory Dijkstra: Shortest Reach 2 Hard 60 Solution.java Graph Theory The Story of a Tree Medium 50 Solution.cpp Graph Theory Prim's (MST) : Special Subtree Medium 60 Solution.java Graph Theory Floyd : City of Blinding Lights Hard 75 Solution.java Greedy Minimum Absolute Difference in ...
Leetcode: Practice Trie Back To Top ⬆️ 3.11 Graph Data Structure Moving on to another crucial non-linear structure, let's explore the Graph. Unlike the Tree, a Graph lacks a specific root or leaf node and allows traversal in any order. ...
My Solutions to Leetcode problems. All solutions support C++ language, some support Java and Python. Multiple solutions will be given by most problems. Enjoy:) 我的Leetcode解答。所有的问题都支持C++语言,一部分问题支持Java语言。近乎所有问题都会提供多个算法解决。大家加油!:) 0 stars 720 forks ...