-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
name: house-robber-ii url: https://leetcode.com/problems/house-robber-ii difficulty: 2 time: -1.0 ms time-rank: -1 % time-complexity: O(N) space: -1.0 MB space-rank: -1.0 % space-complexity: O(N) Fixes #303 Signed-off-by: Christopher Friedt <[email protected]>
- Loading branch information
Showing
2 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* Copyright (c) 2021, Christopher Friedt | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
#include <gtest/gtest.h> | ||
|
||
#include "house-robber-ii.cpp" | ||
|
||
using namespace std; | ||
|
||
TEST(HouseRobberIi, 2_3_2) { | ||
vector<int> nums = {2, 3, 2}; | ||
EXPECT_EQ(3, Solution().rob(nums)); | ||
} | ||
|
||
TEST(HouseRobberIi, 1_2_3_1) { | ||
vector<int> nums = {1, 2, 3, 1}; | ||
EXPECT_EQ(4, Solution().rob(nums)); | ||
} | ||
|
||
TEST(HouseRobberIi, 0) { | ||
vector<int> nums = {0}; | ||
EXPECT_EQ(0, Solution().rob(nums)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* Copyright (c) 2021, Christopher Friedt | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
// clang-format off | ||
// name: house-robber-ii | ||
// url: https://leetcode.com/problems/house-robber-ii | ||
// difficulty: 2 | ||
// clang-format on | ||
|
||
#include <vector> | ||
|
||
using namespace std; | ||
|
||
class Solution { | ||
public: | ||
int rob(vector<int> &nums) {} | ||
}; |