File tree 2 files changed +18
-0
lines changed
2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change 40
40
1 . [ Minimum Depth of Binary Tree] ( https://leetcode.com/explore/challenge/card/october-leetcoding-challenge/562/week-4-october-22nd-october-28th/3504/ ) ➡️ [ CPP Solution] ( Week4/minDepth.cpp )
41
41
2 . [ 132 Pattern] ( https://leetcode.com/explore/challenge/card/october-leetcoding-challenge/562/week-4-october-22nd-october-28th/3505/ ) ➡️ [ CPP Solution] ( Week4/find132pattern.cpp )
42
42
3 . [ Bag of Tokens] ( https://leetcode.com/explore/challenge/card/october-leetcoding-challenge/562/week-4-october-22nd-october-28th/3506/ ) ➡️ [ CPP Solution] ( Week4/bagOfTokensScore.cpp )
43
+ 4 . [ Stone Game IV] ( https://leetcode.com/explore/challenge/card/october-leetcoding-challenge/562/week-4-october-22nd-october-28th/3507/ ) ➡️ [ CPP Solution] ( Week4/winnerSquareGame.cpp )
43
44
44
45
## Week 5 🚧
45
46
Original file line number Diff line number Diff line change
1
+ class Solution {
2
+ public:
3
+ bool winnerSquareGame (int n) {
4
+ vector<bool > dp (n + 1 , false );
5
+
6
+ for (int i = 1 ; i <= n; ++i) {
7
+ for (int j = 1 ; j * j <= i; ++j) {
8
+ if (!dp[i - j * j]) {
9
+ dp[i] = true ;
10
+ break ;
11
+ }
12
+ }
13
+ }
14
+
15
+ return dp[n];
16
+ }
17
+ };
You can’t perform that action at this time.
0 commit comments