题目如下: (This problem is an interactive problem.) On the sea represented by a cartesian plane, each ship is located at an integer point, and each integer point may contain at most 1 ship. You have a function Sea.hasShips(topRight, bottomLeft) which tak…
[LeetCode]Largest Number 解题报告 标签(空格分隔): LeetCode 题目地址:https://leetcode.com/problems/largest-number/#/description 题目描述: Given a list of non negative integers, arrange them such that they form the largest number. For example, given [3, 30, 34, 5, 9], t…
[LeetCode]792. Number of Matching Subsequences 解题报告(Python) 作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 题目地址:https://leetcode.com/problems/number-of-matching-subsequences/description/ 题目描述: Given string S and a dictionary of words words,…
[LeetCode]673. Number of Longest Increasing Subsequence 解题报告(Python) 标签(空格分隔): LeetCode 题目地址:https://leetcode.com/problems/number-of-longest-increasing-subsequence/description/ 题目描述: Given an unsorted array of integers, find the number of longest inc…
Single Number I : Given an array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory? Solution: 解法不少,贴一种: class…
原题链接 https://leetcode.com/problems/number-complement/ 原题 Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation. Note: The given integer is guaranteed to fit within the range o…
作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 右移32次 计算末尾的1的个数 转成二进制统计1的个数 使用mask 日期 [LeetCode] 题目地址:https://leetcode.com/problems/number-of-1-bits/ Total Accepted: 88721 Total Submissions: 236174 Difficulty: Easy 题目描述 Writ…
作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 字典统计 代码 复杂度分析 日期 题目地址:https://leetcode.com/problems/number-of-equivalent-domino-pairs/ 题目描述 Given a list of dominoes, dominoes[i] = [a, b] is equivalent to dominoes[j] = [c, d]…
作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 日期 [LeetCode] 题目地址:https://leetcode.com/problems/number-of-boomerangs/ Difficulty: Easy 题目描述 Given n points in the plane that are all pairwise distinct, a "boomerang" is a…
作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 回溯法 日期 题目地址:https://leetcode.com/problems/number-of-squareful-arrays/ 题目描述 Given an array A of non-negative integers, the array is squareful if for every pair of adjacent eleme…