2#include "gtest/gtest.h"
8 namespace license_key_formatting {
9 TEST(license_key_formatting, case1) {
10 auto s = string(
"5F3Z-2e-9-w");
14 TEST(license_key_formatting, case2) {
15 auto s = string(
"2-5g-3-J");
20 namespace distribute_candies {
21 TEST(distribute_candies, case1) {
30 auto vec = vector(begin(input), end(input));
34 TEST(distribute_candies, case2) {
35 int input[] = {1, 1, 2, 2, 3, 3, 4, 5, 6, 6, 7, 8};
36 auto vec = vector(begin(input), end(input));
41 namespace remove_extra {
42 TEST(remove_extra, case1) {
43 string input =
"The sky is blue";
47 TEST(remove_extra, case2) {
48 string input =
" low ercase ";
53 namespace character_deletion {
54 TEST(character_deletion, case1) {
55 auto str = string(
"They are students");
56 auto sub = string(
"aeiou");
61 namespace judge_circle {
62 TEST(judge_circle, case1) {
63 auto str = string(
"UD");
67 TEST(judge_circle, case2) {
68 auto str = string(
"LL");
91 namespace min_path_sum {
92 TEST(min_path_sum, case1) {
93 int input[3][3] = {{1, 3, 1}, {1, 5, 1}, {4, 2, 1}};
94 auto vec = vector<vector<int>>();
96 for(
int i = 0; i < 3; i++) {
97 const auto to_add = vector(begin(input[i]), end(input[i]));
101 ASSERT_EQ(7, sol.minPathSum(
vec));
105 int input[1][3] = {{1, 3, 2}};
106 auto vec = vector<vector<int>>();
108 for(
int i = 0; i < 1; i++) {
109 const auto to_add = vector(begin(input[i]), end(input[i]));
113 ASSERT_EQ(6, sol.minPathSum(
vec));
117 int input[8][8] = {{1, 4, 8, 6, 2, 2, 1, 7}, {4, 7, 3, 1, 4, 5, 5, 1}, {8, 8, 2, 1, 1, 8, 0, 1}, {8, 9, 2, 9, 8, 0, 8, 9}, {5, 7, 5, 7, 1, 8, 5, 5}, {7, 0, 9, 4, 5, 6, 5, 6}, {4, 9, 9, 7, 9, 1, 9, 0}};
118 auto vec = vector<vector<int>>();
120 for(
int i = 0; i < 8; i++) {
121 const auto to_add = vector(begin(input[i]), end(input[i]));
125 ASSERT_EQ(37, sol.minPathSum(
vec));
129 namespace digit_counts {
TEST(license_key_formatting, case1)
TEST(distribute_candies, case1)
TEST(remove_extra, case1)
TEST(character_deletion, case1)
TEST(judge_circle, case1)
TEST(min_path_sum, case1)
TEST(digit_counts, case1)
static string licenseKeyFormatting(string &, int)
static int distributeCandies(vector< int > &candies)
static string removeExtra(string &s)
static string CharacterDeletion(string &str, string &sub)
static bool judgeCircle(string &moves)
static string convert(long long index)
static int digitCounts(int k, int n)