不为成仙,只为在这红尘中等你回来。

74.Search a 2D Matrix [Medium] [Array | Binary Search]

    ### 题意 Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: 编写一个高效的算法来判断 m x n 矩阵中,是否存在一个目标值。该矩阵具有如下特性: - Integers in each row are sorted from left to right. - 每行中的整数从左到右按升序排列...

    阅读全文>>

2020年11月7日 16:28 作者:nancy 分类:[LeetCode] 1533

350. Intersection of Two Arrays II [Easy]

    ### 题意 Given two arrays, write a function to compute their intersection. 给定两个数组,写一个方法来计算它们的交集。 Example: ``` Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2, 2]. ``` Note: - Each element in the result should appear as many times...

    阅读全文>>

2018年5月15日 10:29 作者:nancy 分类:[LeetCode] 1241

349. Intersection of Two Arrays [Easy]

    ### 题意 Given two arrays, write a function to compute their intersection. 给定两个数组,写一个函数来计算它们的交集。 Example: ``` Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2]. ``` Note: - Each element in the result must be unique. - 每个在结果中的元素必定...

    阅读全文>>

2018年5月15日 09:28 作者:nancy 分类:[LeetCode] 1377

35. Search Insert Position [Easy] [Array | Binary Search]

    ### 题意 Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order. 给定一个排序数组和一个目标值,在数组中找到目标值,并返回其索引。如果目标值不存在于数组中,返回它将会被按顺序插入的位置。 You may assume no...

    阅读全文>>

2018年3月22日 22:01 作者:nancy 分类:[LeetCode] 1299

69. Sqrt(x) [Easy] [Math | Binary Search]

    ### 题意 Implement int sqrt(int x). 实现 int sqrt(int x) 函数。 Compute and return the square root of x, where x is guaranteed to be a non-negative integer. 计算并返回 x 的平方根,其中 x 是非负整数。 Since the return type is an integer, the decimal digits are...

    阅读全文>>

2018年3月13日 22:18 作者:nancy 分类:[LeetCode] 1244