Leetcode 2021-11-29

261. Graph Valid Tree (Medium)

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.

阅读全文 »

Leetcode 2021-11-30

271. Encode and Decode Strings (Medium)

Design an algorithm to encode a list of strings to a string. The encoded string is then sent over the network and is decoded back to the original list of strings.

阅读全文 »

Leetcode 2021-12-03

301. Remove Invalid Parentheses (Hard)

Given a string s that contains parentheses and letters, remove the minimum number of invalid parentheses to make the input string valid.

阅读全文 »

Leetcode 2021-11-27

241. Different Ways to Add Parentheses (Medium)

Given a string expression of numbers and operators, return all possible results from computing all the different possible ways to group numbers and operators. You may return the answer in any order.

阅读全文 »

Leetcode 2021-11-26

231. Power of Two (Easy)

Given an integer n, return true if it is a power of two. Otherwise, return false.An integer n is a power of two, if there exists an integer x such that n == 2^x.

阅读全文 »

Leetcode 2021-11-23

201. Bitwise AND of Numbers Range (Medium)

Given two integers left and right that represent the range [left, right], return the bitwise AND of all numbers in this range, inclusive.

阅读全文 »

Leetcode 2021-11-22

191. Number of 1 Bits (Easy)

Write a function that takes an unsigned integer and returns the number of '1' bits it has (also known as the Hamming weight).

阅读全文 »