Minimum Factorization
来源:互联网 发布:婚礼 简单 知乎 编辑:程序博客网 时间:2024/06/01 08:46
Given a positive integer a
, find the smallest positive integer b
whose multiplication of each digit equals to a
.
If there is no answer or the answer is not fit in 32-bit signed integer, then return 0.
Example 1
Input:
48Output:
68
Example 2
Input:
15Output:
35
Solution:
class Solution {public: int smallestFactorization(int a) { if(a<10)return a; vector<int> tmp; for(int i=9;i>1;i--) while(a%i==0) { a = a/ i; tmp.push_back(i); } if(a>10) return 0; long long ret =0; for(int i =tmp.size()-1;i>=0;i--) { ret = ret*10+tmp[i]; if(ret>2147483647) return 0; } return ret; }};
阅读全文
0 0
- Minimum Factorization
- leetcode-625. Minimum Factorization
- LeetCode Minimum Factorization
- 625. Minimum Factorization
- 625Minimum Factorization
- leetcode 625. Minimum Factorization
- leetcode 625. Minimum Factorization
- 625. Minimum Factorization & 621. Task Scheduler
- Factorization
- Factorization Machines
- Integer Factorization
- Matrix factorization
- matrix factorization
- Factorization Machine
- Minimum
- Sicily 4481. Prime Factorization
- TOJ 10004 Prime Factorization
- POJ 3892 RSA Factorization
- 管理和回收Activity → AppDavikActivityMgr
- 560. Subarray Sum Equals K 题解
- 【php】提高网页加载速度
- 基于Beaglebone black的FreeBSD开启无线网卡
- TCP相关基础知识
- Minimum Factorization
- ThreadLocal快速明白
- php和sqlserver
- 两个Activity跳转的时候,执行的生命周期方法
- 深度学习(六十七)metal forge深度学习库使用
- 基于Madplay的MP3音乐播放器
- Android中自定义View仿京东秒杀倒计时
- stm32f407 学习过程中时钟问题(整理记录)
- ntp 网络攻击与解决方法(3种)