mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-13 19:31:42 +08:00
add leetcode problem-cn part1
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
<p>The Tribonacci sequence T<sub>n</sub> is defined as follows: </p>
|
||||
|
||||
|
||||
|
||||
<p>T<sub>0</sub> = 0, T<sub>1</sub> = 1, T<sub>2</sub> = 1, and T<sub>n+3</sub> = T<sub>n</sub> + T<sub>n+1</sub> + T<sub>n+2</sub> for n >= 0.</p>
|
||||
|
||||
|
||||
|
||||
<p>Given <code>n</code>, return the value of T<sub>n</sub>.</p>
|
||||
|
||||
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong>Example 1:</strong></p>
|
||||
|
||||
|
||||
|
||||
<pre>
|
||||
|
||||
<strong>Input:</strong> n = 4
|
||||
|
||||
<strong>Output:</strong> 4
|
||||
|
||||
<strong>Explanation:</strong>
|
||||
|
||||
T_3 = 0 + 1 + 1 = 2
|
||||
|
||||
T_4 = 1 + 1 + 2 = 4
|
||||
|
||||
</pre>
|
Reference in New Issue
Block a user