Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ca74de4

Browse files
Initial commit
1 parent 76aa744 commit ca74de4

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed

‎AlgoDaily/array-intersection.py‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# This is my solution for AlgoDaily problem Array Intersection
2+
# Located at https://algodaily.com/challenges/array-intersection
3+
4+
def intersection(nums1, nums2):
5+
x = set(nums1)
6+
y = set(nums2)
7+
return list(x.intersection(y))

‎AlgoDaily/fizz-buzz.py‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# This is my solution for AlgoDaily problem Fizz Buzz
2+
# Located at https://algodaily.com/challenges/fizz-buzz
3+
4+
def fizz_buzz(n):
5+
res = []
6+
for i in range(1, n+1):
7+
s = ''
8+
if i % 3 == 0:
9+
s += 'fizz'
10+
if i % 5 == 0:
11+
s += 'buzz'
12+
if len(s) == 0:
13+
s = str(i)
14+
res.append(s)
15+
return ''.join(res)
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# This is my solution for AlgoDaily problem Reverse Only Alphabetical
2+
# Located at https://algodaily.com/challenges/reverse-only-alphabetical
3+
4+
import re
5+
6+
7+
def reverse_only_alpha(s):
8+
index = -1
9+
text = list(s)
10+
for i in range(len(text)-1, int(len(text)/2), -1):
11+
if text[i].isalpha():
12+
temp = text[i]
13+
while True:
14+
index += 1
15+
if text[index].isalpha():
16+
text[i] = text[index]
17+
text[index] = temp
18+
break
19+
return ''.join(text)
20+
21+
22+
def reverse_array(arr):
23+
return arr[::-1]
24+

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /