Skip to content

Commit a282cb8

Browse files
authored
Create Ugly-Number.java and Updated README.md (#152)
* Create Ugly-Number.java * Update README.md
1 parent 6686627 commit a282cb8

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

Diff for: Java/Ugly-Number.java

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
class Solution {
2+
public boolean isUgly(int num) {
3+
if(num == 0) return false;
4+
if(num == 1) return true;
5+
6+
if(num % 2 == 0){
7+
num = num / 2;
8+
return isUgly(num);
9+
}
10+
11+
if(num % 3 == 0){
12+
num=num / 3;
13+
return isUgly(num);
14+
}
15+
16+
if(num % 5 == 0){
17+
num = num / 5;
18+
return isUgly(num);
19+
}
20+
21+
return false;
22+
}
23+
}

Diff for: README.md

+4
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,9 @@ Check out ---> [Sample PR](https://github.com/codedecks-in/LeetCode-Solutions/pu
299299
| 12 | [Integer to Roman](https://leetcode.com/problems/integer-to-roman) | [Java](./Java/integer-to-roman.java) | _O(n)_ | _O(1)_ | Medium | Math | |
300300
| 13 | [Roman to Integer](https://leetcode.com/problems/roman-to-integer) | [Java](./Java/roman-to-integer.java) | _O(n)_ | _O(1)_ | Easy | Math | |
301301
| 14 | [Arithmetic Subarrays](https://leetcode.com/problems/arithmetic-subarrays/) | [Java](./Java/Arithmetic-Subarrays.java) | _O(m*n)_ | _O(n)_ | Medium | Math | Pattern Count |
302+
| 263 | [Ugly Number](https://leetcode.com/problems/ugly-number/) | [Java](./Java/Ugly-Number.java) | _O(n)_ | _O(n)_ | Easy | Math | |
303+
304+
302305

303306
<br/>
304307
<div align="right">
@@ -476,6 +479,7 @@ DISCLAIMER: This above mentioned resources have affiliate links, which means if
476479
| [Franchis N. Saikia](https://github.com/Francode007) <br> <img src="https://avatars0.githubusercontent.com/u/63102937?s=400&v=4" width="100" height="100"> | India | C++ | [Github](https://github.com/Francode007) |
477480
| [Yarncha](https://github.com/yarncha) <br> <img src="https://avatars0.githubusercontent.com/u/33623182?s=400&v=4" width="100" height="100"> | South Korea | C++ | [LeetCode](https://leetcode.com/yamcha/) |
478481
| [Gamez0](https://github.com/Gamez0) <br> <img src="https://avatars3.githubusercontent.com/u/34051876?s=400&v=4" width="100" height="100"> | South Korea | Python | [LeetCode](https://leetcode.com/Gamez0/) |
482+
| [JeongDaHyeon](https://github.com/JeongDaHyeon) <br> <img src="https://avatars0.githubusercontent.com/u/48541114?s=460&v=4" width="100" height="100"> | South Korea | Java | [GitHub](https://github.com/JeongDaHyeon) |
479483
<br/>
480484
<div align="right">
481485
<b><a href="#algorithms">⬆️ Back to Top</a></b>

0 commit comments

Comments
 (0)