Algorithms

Algorithms

[LeetCode 472] Concatenated Words

References: https://leetcode.com/problems/concatenated-words/ Time complexity: , where is the length of the input word ...
Algorithms

[LeetCode 1091] Shortest Path in Binary Matrix

References: https://leetcode.com/problems/shortest-path-in-binary-matrix/ Solution
Algorithms

[LeetCode 957] Prison Cells After N Days

Solution Overview First of all, one can consider this problem as a simplified ...
Algorithms

[LeetCode 1135] Connecting Cities With Minimum Cost

References https://leetcode.com/problems/connecting-cities-with-minimum-cost/ https://www.youtube.com/watch?v=GFsPyTdCS1I Solution Approach 1: Minimum Spanning Tree (Using Kruskal’s algorithm) Intuition ...
Algorithms

[LeetCode 1629] Slowest Key

A newly designed keypad was tested, where a tester pressed a sequence of n keys, ...
Algorithms

LeetCode 837. New 21 Game.

Alice plays the following game, loosely based on the card game “21”. Alice ...
Algorithms

[LeetCode 1104] Path in ZigZag Labelled Binary Tree

In an infinite binary tree where every node has two children, the nodes ...
Algorithms

[LeetCode 1008] Construct Binary Tree From Preorder Traversal

Given an array of integers preorder, which represents the preorder traversal of a BST (i.e., binary ...
Algorithms

[LeetCode 1766] Tree of Coprimes

There is a tree (i.e., a connected, undirected graph that has no cycles) consisting ...