Skip to content

Commit

Permalink
add 5 solution.
Browse files Browse the repository at this point in the history
  • Loading branch information
tangs committed Dec 29, 2023
1 parent f335f80 commit d8d2633
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/5/solution.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include <string>
#include <vector>

class Solution {
public:
std::string longestPalindrome(std::string s) {
const auto n = s.size();
s.insert(0, "-");

std::vector<int> dp(n, 1);
dp[0] = 0;

for (int i = 0; i < n; ++i) {
for (int j = i + 1; j < n; ++j) {

}
}

return {};
}
};
37 changes: 37 additions & 0 deletions tests/5/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
cmake_minimum_required(VERSION 3.10)
project(dp_solution_pipeline)

set(CMAKE_CXX_STANDARD 17)

set(PROBLEM_NAME 5)

include(FetchContent)
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip
)
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)

set(SRC_ROOT_PATH ${ROOT_PATH}/src)
set(SRC_PATH ${SRC_ROOT_PATH}/${PROBLEM_NAME})
set(TESTS_PATH ${ROOT_PATH}/tests/${PROBLEM_NAME})

include_directories(
${SRC_ROOT_PATH}
${SRC_PATH}
${TESTS_PATH}
)

# test.
enable_testing()

add_executable(
test_${PROBLEM_NAME}
${TESTS_PATH}/test.cc
)
target_link_libraries(test_${PROBLEM_NAME} GTest::gtest_main)


include(GoogleTest)
gtest_discover_tests(test_${PROBLEM_NAME})
8 changes: 8 additions & 0 deletions tests/5/test.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include <gtest/gtest.h>

#include "utils/utils.h"
#include "solution.hpp"

TEST(longest_palindromic_substring_testing, BasicAssertions) {

}
1 change: 1 addition & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ add_subdirectory(63)
add_subdirectory(120)
add_subdirectory(931)
add_subdirectory(221)
add_subdirectory(5)

0 comments on commit d8d2633

Please sign in to comment.