Continue reading

# [leetcode题解]547. Friend Circles,朋友圈

There are N students in a class. Some of them are friends, while some are not. Their friendship is transitive in nature. For example, if A is a direct friend of B, and B is a  …

Continue reading

# [leetcode题解]859. Buddy Strings

Given two strings A and B of lowercase letters, return true if and only if we can swap two letters in A so that the result equals B.   Example 1: …

Continue reading

# [leetcode题解]130. Surrounded Regions

Given a 2D board containing ‘X’ and ‘O’ (the letter O), capture all regions surrounded by ‘X’. A region is captured by flipping all &# …

Continue reading

# [leetcode题解]303. Range Sum Query – Immutable

Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive. Example: Given nums = [-2, 0, 3, -5, 2, -1] sumRange(0, 2) -&gt …

Continue reading

# [leetcode题解]快速求解某数的下取整平方根

leetcode第69题，计算某数的下取整平方根sqrt(x) 题目如下： Implement int sqrt(int x). Compute and return the square root of x, where x is guaranteed to be a non-negative integer. Since the return type& …

Continue reading