1137
This commit is contained in:
14
include/solution/1137.h
Normal file
14
include/solution/1137.h
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
// This file is generated by mkfile.py
|
||||||
|
// Date: 2025-12-05
|
||||||
|
|
||||||
|
#ifndef INC_1137_H
|
||||||
|
#define INC_1137_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
int tribonacci(int n);
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif // INC_1137_H
|
||||||
7
src/1137.c
Normal file
7
src/1137.c
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
// This file is generated by mkfile.py
|
||||||
|
// Date: 2025-12-05
|
||||||
|
|
||||||
|
#include <solution/1137.h>
|
||||||
|
int tribonacci(int n)
|
||||||
|
{
|
||||||
|
}
|
||||||
41
tests/test_1137.cpp
Normal file
41
tests/test_1137.cpp
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
// This file is generated by mkfile.py
|
||||||
|
// Date: 2025-12-05
|
||||||
|
|
||||||
|
#include <gtest/gtest.h>
|
||||||
|
#include <solution/1137.h>
|
||||||
|
|
||||||
|
// Tests for tribonacci (LeetCode 1137)
|
||||||
|
class TribonacciTest : public ::testing::Test
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
void AssertTribo(int n, int expected)
|
||||||
|
{
|
||||||
|
ASSERT_EQ(tribonacci(n), expected);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
TEST_F(TribonacciTest, BaseCases)
|
||||||
|
{
|
||||||
|
AssertTribo(0, 0);
|
||||||
|
AssertTribo(1, 1);
|
||||||
|
AssertTribo(2, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(TribonacciTest, SmallNumbers)
|
||||||
|
{
|
||||||
|
AssertTribo(3, 2);
|
||||||
|
AssertTribo(4, 4);
|
||||||
|
AssertTribo(5, 7);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(TribonacciTest, MediumNumbers)
|
||||||
|
{
|
||||||
|
AssertTribo(10, 149);
|
||||||
|
AssertTribo(15, 3136);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(TribonacciTest, UpperBound)
|
||||||
|
{
|
||||||
|
AssertTribo(25, 1389537);
|
||||||
|
AssertTribo(37, 2082876103);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user