Skip to content

Commit e844213

Browse files
committed
Added Python and Java solutions for "Smallest Even Multiple"
1 parent 4bf08cb commit e844213

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

Java/Smallest Even Multiple.java

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
class Solution {
2+
3+
/**
4+
* Time: O(1)
5+
* Memory: O(1)
6+
*/
7+
public int smallestEvenMultiple(int n) {
8+
return n << (n & 1);
9+
}
10+
}

Python/Smallest Even Multiple.py

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
class Solution:
2+
"""
3+
Time: O(1)
4+
Memory: O(1)
5+
"""
6+
7+
def smallestEvenMultiple(self, n: int) -> int:
8+
return n << (n & 1)
0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)