Brute Force(暴力)

class Solution(object):
def powerfulIntegers(self, x, y, bound):
"""
:type x: int
:type y: int
:type bound: int
:rtype: List[int]
"""
ans=[] for i in range(20):
for j in range(20):
a=x**i+y**j
if a<=bound:
ans.append(a) return list(set(ans))

Leetcode 970. Powerful Integers的更多相关文章

  1. LeetCode 970. Powerful Integers (强整数)

    题目标签:HashMap 题目让我们找出所有独一的powerful integers 小于bound的情况下. 把 x^i 看作 a:把 y^j 看作b, 代入for loop,把所有的情况都遍历一遍 ...

  2. 【Leetcode_easy】970. Powerful Integers

    problem 970. Powerful Integers solution: class Solution { public: vector<int> powerfulIntegers ...

  3. 【LeetCode】970. Powerful Integers 解题报告(Python & C++)

    作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 暴力搜索 日期 题目地址:https://leetc ...

  4. 【leetcode】970. Powerful Integers

    题目如下: Given two non-negative integers x and y, an integer is powerful if it is equal to x^i + y^j fo ...

  5. LC 970. Powerful Integers

    Given two non-negative integers x and y, an integer is powerful if it is equal to x^i + y^j for some ...

  6. 【LeetCode】Powerful Integers(强整数)

    这道题是LeetCode里的第970道题. 题目描述: 给定两个正整数 x 和 y,如果某一整数等于 x^i + y^j,其中整数 i >= 0 且 j >= 0,那么我们认为该整数是一个 ...

  7. 118th LeetCode Weekly Contest Powerful Integers

    Given two non-negative integers x and y, an integer is powerful if it is equal to x^i + y^j for some ...

  8. [Swift]LeetCode970.强整数 | Powerful Integers

    Given two non-negative integers x and y, an integer is powerful if it is equal to x^i + y^j for some ...

  9. LeetCode.970-强大的整数(Powerful Integers)

    这是悦乐书的第367次更新,第395篇原创 01 看题和准备 今天介绍的是LeetCode算法题中Easy级别的第229题(顺位题号是970).给定两个正整数x和y,如果对于某些整数i >= 0 ...

随机推荐

  1. C#数组实践

    using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Cont ...

  2. 剑指offer 面试16题

    面试16题: 题目:数值的整数次方 题:实现函数double Power(double base, int exponent),求base的exponent次方.不得使用库函数,同时不需要考虑大数问题 ...

  3. oracle 函数 截取 连接 替换 判断

    一个处理不规范日期的函数,廖记一下吧,以免再忘. --注意全角半角 CREATE OR REPLACE function f_str2form( date_string in varchar2 ) r ...

  4. substring splice

    返回start到end之前 不包括end stringObject.substring(start,end) (不接受负数) stringObject.slice(start,end) start起始 ...

  5. Windows彻底卸载VMWare虚拟机

    彻底卸载VMWare虚拟机 1.停止VMware相关服务 在服务中将VMware开头的所有服务停止 2.打开VMware安装向导 进入卸载页面 在卸载页面中选中VMware右键点击,进入更改后,页面为 ...

  6. VM上安装苹果虚拟机

    用了太久的Windows系统,看着Mac OS X的惊艳,相信很多朋友也和我一样,总想着能把玩一把Mac OS X系统吧?如果只是为了体验一下Mac OS X系统而购买一套Mac电脑,那是土豪做的事. ...

  7. STM32系列第15篇--灵活的静态存储控制器FSMC

    源: STM32系列第15篇--灵活的静态存储控制器FSMC

  8. 对正交频分复用OFDM系统的理解

    OFDM系统 正交频分复用OFDM(Orthogonal Frenquency Division Multiplexing)是一种多载波调制技术. 基本思想:在发送端,它将高速串行数据经过串并变换形成 ...

  9. MongoDB快速入门(五)- Where子句

    RDBMS Where子句等效于MongoDB 查询文档在一些条件的基础上,可以使用下面的操作 操作 语法 示例 RDBMS等效语句 Equality {<key>:<value&g ...

  10. poj 1330 【最近公共祖先问题+fa[]数组+ 节点层次搜索标记】

    题目地址:http://poj.org/problem?id=1330 Sample Input 2 16 1 14 8 5 10 16 5 9 4 6 8 4 4 10 1 13 6 15 10 1 ...