Open in app

Sign In

Write

Sign In

Paul Kang
Paul Kang

Home

About

Nov 8, 2022

All Paths From Source to Target — LC Medium

797. All Paths From Source to Target Given a directed acyclic graph (DAG) of n nodes labeled from 0 to n - 1, find all possible paths from node 0 to node n - 1 and return them in any order. The graph is given as follows: graph[i] is a…

2 min read

All Paths From Source to Target — LC Medium
All Paths From Source to Target — LC Medium

2 min read


Nov 8, 2022

Find if Path Exists in Graph — LC Easy

1971. Find if Path Exists in Graph There is a bi-directional graph with n vertices, where each vertex is labeled from 0 to n - 1 (inclusive). The edges in the graph are represented as a 2D integer array edges, where each edges[i] = [ui, vi] denotes a bi-directional edge…

3 min read

3 min read


Nov 8, 2022

Longest Common Prefix — LC Easy (Medium)

14. Longest Common Prefix Write a function to find the longest common prefix string amongst an array of strings. If there is no common prefix, return an empty string "". Example 1: Input: strs = ["flower","flow","flight"] Output: "fl" Example 2: Input: strs = ["dog","racecar","car"] Output: "" Explanation: There is no common prefix…

1 min read

1 min read


Nov 7, 2022

Container With Most Water — LC Medium

11. Container With Most Water You are given an integer array height of length n. There are n vertical lines drawn such that the two endpoints of the ith line are (i, 0) and (i, height[i]). Find two lines that together with the x-axis form a container, such that the…

1 min read

Container With Most Water — LC Medium
Container With Most Water — LC Medium

1 min read


Nov 6, 2022

The Earliest Moment When Everyone Become Friends — LC Medium

1101. The Earliest Moment When Everyone Become Friends There are n people in a social group labeled from 0 to n - 1. You are given an array logs where logs[i] = [timestampi, xi, yi] indicates that xi and yi will be friends at the time timestampi. Friendship is symmetric…

2 min read

2 min read


Nov 6, 2022

Number of Connected Components in an Undirected Graph — LC Medium

323. Number of Connected Components in an Undirected Graph You have a graph of n nodes. You are given an integer n and an array edges where edges[i] = [ai, bi] indicates that there is an edge between ai and bi in the graph. Return the number of connected components…

2 min read

Number of Connected Components in an Undirected Graph — LC Medium
Number of Connected Components in an Undirected Graph — LC Medium

2 min read


Nov 6, 2022

Graph Valid Tree — LC Medium

261. Graph Valid Tree You have a graph of n nodes labeled from 0 to n - 1. You are given an integer n and a list of edges where edges[i] = [ai, bi] indicates that there is an undirected edge between nodes ai and bi in the graph. Return…

2 min read

Graph Valid Tree — LC Medium
Graph Valid Tree — LC Medium

2 min read


Nov 6, 2022

Number of Provinces — LC Medium

547. Number of Provinces There are n cities. Some of them are connected, while some are not. If city a is connected directly with city b, and city b is connected directly with city c, then city a is connected indirectly with city c. A province is a group of…

2 min read

2 min read


Nov 6, 2022

Redundant Connection — LC Medium

684. Redundant Connection In this problem, a tree is an undirected graph that is connected and has no cycles. You are given a graph that started as a tree with n nodes labeled from 1 to n, with one additional edge added. The added edge has two different vertices chosen…

2 min read

Redundant Connection — LC Medium
Redundant Connection — LC Medium

2 min read


Nov 6, 2022

Smallest String With Swaps — LC Medium

1202. Smallest String With Swaps You are given a string s, and an array of pairs of indices in the string pairs where pairs[i] = [a, b] indicates 2 indices(0-indexed) of the string. You can swap the characters at any pair of indices in the given pairs any number of…

2 min read

2 min read

Paul Kang

Paul Kang

Data Scientist, SWE + MLE

Help

Status

Writers

Blog

Careers

Privacy

Terms

About

Text to speech