Skip to content

Commit 7e86b13

Browse files
authored
Create Count Total Number of Colored Cells.java
1 parent 88ecb65 commit 7e86b13

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class Solution {
2+
public long coloredCells(int n) {
3+
long count = 1;
4+
int increment = 4;
5+
while (n-- > 1) {
6+
count += increment;
7+
increment += 4;
8+
}
9+
return count;
10+
}
11+
}

0 commit comments

Comments
 (0)