题目传送门:Hamming Distance
题意:给两个整数x,y,求二进制下对应位相异的个数。比如
1–> (0 0 0 1)
4–> (0 1 0 0)
相异位数为2.
题目标题一看貌似是哈密顿路径,其实唬人,水题。
思路:十进制转成二进制保存在数组里,逆序遍历,注意初始化数组为0.
1 | class Solution { |
缺失模块。
1、请确保node版本大于6.2
2、在博客根目录(注意不是yilia根目录)执行以下命令:
npm i hexo-generator-json-content --save
3、在根目录_config.yml里添加配置:
jsonContent: meta: false pages: false posts: title: true date: true path: true text: false raw: false content: false slug: false updated: false comments: false link: false permalink: false excerpt: false categories: false tags: true