GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing leetcode.cn — 868. 二进制间距 - 力扣(LeetCode) 题目描述 题目描述 题解 题解 提交记录 提交记录 简单 给定一个正整数 如果只有
示例 1: 输入:n = 22 输出:2 解释:22 的二进制是 "10110" 。 在 22 的二进制表示中,有三个 1,组成两对相邻的 1 。 第一对相邻的 1 中,两个 1 之间的距离为 2 。 第二对相邻的 1 中,两个 1 之间的距离为 1 。 答案取两个距离之中最大的,也就是 2 。 示例 2: 输入:n = 8 输出:0 解释:8 的二进制是 "1000" 。 在 8 的二进制表示中没有相邻的两个 1,所以返回 0 。 示例 3: 输入:n = 5 输出:2 解释:5 的二进制是 "101" 。
提示:
代码 代码 测试用例 测试用例 测试结果 测试结果 |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |