Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Siu, Pui Chung
codewar solutions
Commits
4cb650ba
Commit
4cb650ba
authored
Jul 21, 2021
by
Siu, Pui Chung
Browse files
Add new file
parent
c787b7e2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Twice_linear.py
0 → 100644
View file @
4cb650ba
def
dbl_linear
(
n
):
list
=
[
1
]
y_pos
=
0
z_pos
=
0
while
len
(
list
)
<=
n
:
y
=
2
*
list
[
y_pos
]
+
1
z
=
3
*
list
[
z_pos
]
+
1
if
y
>
z
:
list
.
append
(
z
)
z_pos
+=
1
elif
y
<
z
:
list
.
append
(
y
)
y_pos
+=
1
elif
y
==
z
:
list
.
append
(
y
)
z_pos
+=
1
y_pos
+=
1
print
(
list
[
n
])
return
list
[
n
]
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment